我一直在使用 Ruby selenium-webdriver gem 对工作中的 Web 应用程序执行一些测试。一件很棒的事情是能够在执行定时页面加载等之前以编程方式清除浏览器缓存,但我似乎在文档中找不到任何内容。
有谁知道是否有一种简单的方法可以用宝石做到这一点?
我需要选择一个框架,但它没有名称或 ID。它是如何做到的呢?
<frame src="sampleSrouce" scrolling="yes" frameborder="0" />
<frame src="sampleSource2" scrolling="yes" frameborder="0" />
Run Code Online (Sandbox Code Playgroud)
谢谢!
我正在创建一个使用 [chromedp][1] 的应用程序
如何检查页面中是否存在某个元素?
我尝试使用cdp.WaitVisible(),但它没有给我我想要的东西。
我需要这个,这样我就可以判断应用程序是否会做一件事或另一件事。
对于这个例子,假设我需要知道搜索输入是否存在
我怎样才能做到这一点?
[1]: https: //github.com/knq/chromedp
package main
import (
"context"
"fmt"
"io/ioutil"
"log"
"time"
cdp "github.com/knq/chromedp"
cdptypes "github.com/knq/chromedp/cdp"
)
func main() {
var err error
// create context
ctxt, cancel := context.WithCancel(context.Background())
defer cancel()
// create chrome instance
c, err := cdp.New(ctxt, cdp.WithLog(log.Printf))
if err != nil {
log.Fatal(err)
}
// run task list
var site, res string
err = c.Run(ctxt, googleSearch("site:brank.as", "Easy Money Management", &site, &res))
if err != nil { …Run Code Online (Sandbox Code Playgroud) 用于如下用途
test(testName, async (t) => {
const ua = await getUA()
await t.takeScreenshot(
fixtureName +
"/" +
testName +
"/" +
identifyUserAgent(ua) +
"/" +
"scsh_1.png",
)
...
Run Code Online (Sandbox Code Playgroud)
从 testcafe@0.21.1 开始,我的解决方法是
const fixtureName = "Index_Page_Test"
fixture(fixtureName).page(...)
...
const testName = "dom_has_critical_elements"
test(testName, async (t) => {
...
Run Code Online (Sandbox Code Playgroud)
但更愿意在 t 上提供它。我错过了什么吗?
我有多个装置(一个网站和一个混合应用程序之间的交互),我想运行一个测试套件(烟雾测试,回归测试...),但是我不确定该怎么做。
这是我的测试结果:
我想做的是运行所有测试(例如CreatePollAndCloseIt.js,CreatePollPinAndDelete.js,CreateStreamAssertions.js等,直到最后一个VotePollWhitelabel),然后获取报告。
谢谢!
automated-tests code-organization web-testing e2e-testing testcafe
我在更改用户代理时遇到问题。
我正在尝试在浏览器数组的 runner.js 文件中使用以下行:
chrome:headless:userAgent=Mozilla/5.0\ \(Linux\;\ Android\ 5.0\;\ SM-G900P\ Build/LRX21T\)\ AppleWebKit/537.36\ \(KHTML,\ like\ Gecko\)\ Chrome/57.0.2987.133\ Mobile\ Safari/537.36
Run Code Online (Sandbox Code Playgroud)
但是,我能得到的最好的是Mozilla/5.0(实际用户代理中的Linux。
该指南没有明确说明用户代理以及如何逃避它们。
有人可以帮助我为无头 chrome 使用自定义用户代理吗?我似乎无法克服逃避问题。谢谢。
automated-tests web-testing e2e-testing testcafe google-chrome-headless
我进行了一项测试,如果测试失败,则表明该应用程序存在较大问题。如果一项测试失败,那么运行其余测试将毫无意义。
如果单个测试失败,是否有办法保全套件,但如果该测试通过,则运行所有测试?
我有一个简单的代码,其结构如下所示:
<div>
<style>label { property: value; }</style>
<label id="id1">text</label>
</div>
Run Code Online (Sandbox Code Playgroud)
我的目标是断言 css 属性是否等于 not 的值。
我尝试过像这样使用 getStyleProperty :
const sel = Selector('#id1').getStyleProperty('property')
Run Code Online (Sandbox Code Playgroud)
但是,它总是返回未定义的值,有什么我想念的吗?
我有一套测试,当没有并发运行时,所有测试都可以通过。当我开始并发运行它们时,它们开始崩溃。我不认为测试之间存在相互依赖关系,这会使它们失败。如果测试失败,则如下所示:
1) A JavaScript error occurred on
"https://advancedaccount.wistia.io/stats/medias/lz45f2dspl#social".
Repeat test actions in the browser and check the console for errors.
If you see this error, it means that the tested website caused it. You can fix it or disable tracking JavaScript errors in TestCafe. To do the latter, enable the
"--skip-js-errors" option.
If this error does not occur, please write a new issue at:
"https://github.com/DevExpress/testcafe/issues/new?template=bug-report.md".
JavaScript error details:
undefined:
No stack trace available
Browser: Chrome 73.0.3683 / Linux 0.0.0
Screenshot: …Run Code Online (Sandbox Code Playgroud) concurrency automated-tests web-testing e2e-testing testcafe
我有一个场景,其中同一元素的多个元素一个接一个地className出现(这取决于服务器的响应)。
我要实现的目标是仅在存在相同选择器的2个元素之后才通过测试,但是目前看来,该测试失败了,因为它不断识别1个元素,然后直接失败而没有等待第二个元素。
这是我的代码(从外部调用,count参数为2)-
import { Selector } from 'testcafe';
export const validateMsg = async (t, headlineText, count = 1) => {
const msgHeadline = Selector('.myClassName').withText(headlineText).exists;
const msgHeadLineExists = await t
.expect(msgHeadline.count)
.gte(count, `Received less than ${count} desired messages with headline ${headlineText}`);
return msgHeadLineExists;
};
Run Code Online (Sandbox Code Playgroud)
我认为发生这种情况是因为我正在检查是否msgHeadline存在,并且呈现它时会看到第一个元素,并立即失败。我想等第二个。
有任何想法吗?
web-testing ×10
e2e-testing ×7
testcafe ×7
testing ×3
concurrency ×1
css ×1
go ×1
html ×1
ruby ×1
selenium ×1
web ×1