Testcafe 测试未在 Ubuntu(AWS 机器)中运行
我已经为所有可用的浏览器执行了以下命令
testcafe "chrome" abc.js
testcafe "chrome:headless" abc.js
testcafe "firefox" abc.js
testcafe "firefox:headless" abc.js
testcafe "chromium" abc.js
testcafe "chromium:headless" abc.js
Run Code Online (Sandbox Code Playgroud)
我收到以下执行 testcafe 命令的错误消息
错误:没有要运行的测试。要么测试文件不包含测试,要么过滤功能太严格。
我面临的问题是 Puppeteer 不加载使用相对路径指定的资源(例如background.png
在 imagesrc
或 css中url()
)。这样,我使用setContent()
结果加载本地文件的内容与我执行相同操作但使用goto(file://)
.
显然,然后使用“setContent()”,页面停留在“about:page”,并阻止加载具有相对路径的资源。我想知道是否有任何方法可以指定文档位置并从字符串加载内容?
我会使用goto
,但我需要先用 Handlebar 预处理 html。
现在,我执行以下操作:
await page.goto(framePath);
let content = await page.content();
//Preprocess content here
await page.setContent(processedContent);
Run Code Online (Sandbox Code Playgroud)
但感觉不太对劲,我想知道是否有更好的解决方案。
剧作家专家您好,
我有这个输入字段
<input id="myName" placeholder="e.g. Max" maxlength="15" class="xyz"/>
Run Code Online (Sandbox Code Playgroud)
我试过这个JAVA代码:
page.locator("[placeholder=\"e.g. Max\"]").textContent();
Run Code Online (Sandbox Code Playgroud)
它不起作用:-(但我可以填写
page.locator("[placeholder=\"e.g. Max\"]").fill("Loren"); // this works
Run Code Online (Sandbox Code Playgroud)
你能帮忙并有一个想法吗?
先感谢您。
干杯 洛伦
我正在寻找Perl中的网页自动化工具.我希望能够从我的测试脚本中驱动不同的浏览器,如IE,firefox等.我必须自动化一个包含大量输入字段和大量javascript的产品网页.我不想像机械化这样的自定义浏览器.我曾经和Ruby一起使用Watir.Perl中有类似的东西吗?
我正在尝试通过Web自动执行从移动设备访问时行为不同的应用程序。有谁知道使用Selenium 2实现此目标的最佳方法?
在理想的世界中,我想找到一种方法来仅配置用户代理,以便我们可以轻松地测试许多排列。
我需要在Chrome浏览器中使用Selenium等待网站自动化中的特定网址.用户将在我们的网站上进行在线支付.我们的网站用户被重定向到支付网关.当用户完成付款时,网关将重定向到我们的网站.我希望得到从网关到我们网站的通知重定向.
我在网页上有一个等待"特殊ID"的例子,这里是vb.net代码
driver.Url = "http://gmail.com"
Dim wait As New WebDriverWait(driver, TimeSpan.FromSeconds(10))
wait.Until(Of IWebElement)(Function(d) d.FindElement(By.Id("next")))
Run Code Online (Sandbox Code Playgroud)
这导航到"gmail.com"并等待该页面上的"下一个"ID.相反,我想只在特定URL加载时继续代码.
我怎样才能做到这一点?
请帮我.
我的 html 文档是
<div class="inner-column">
<div data-thing="abc1"></div>
<div data-thing="abc2"></div>
<div data-thing="abc3"></div>
</div>
Run Code Online (Sandbox Code Playgroud)
如何在 .inner-column 类的 div 中获取所有“数据事物”值(例如 [“abc1”、“abc2”、“abc3”])?
const puppeteer = require('puppeteer');
const fs = require('fs');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
page.setViewport({width: 1440, height: 1200})
await page.goto('https://www.example.com')
const data = await page.content();
await browser.close();
})();
Run Code Online (Sandbox Code Playgroud) 我正在单击包含确认对话框但无法关闭的链接。
我尝试按“Enter”并使用 puppeteer 的方法关闭并接受对话框,但什么也没发生。
链接:
<a onclick="return confirm('Yes?');" id="link" href="google.com">
Run Code Online (Sandbox Code Playgroud)
我试过:
page.on('dialog', async dialog => {
console.log('here'); //does not pass
await dialog.accept();
//await dialog.dismiss();
});
Run Code Online (Sandbox Code Playgroud)
和
await page.keyboard.press('Enter');
await page.keyboard.press(String.fromCharCode(13));
Run Code Online (Sandbox Code Playgroud) 我正在尝试访问谷歌在剧作家中注册的新弹出窗口,但无法做到这一点。
await page.waitForSelector(signUpWithGoogle, { state: 'visible' })
await page.focus(signUpWithGoogle)
await page.click(signUpWithGoogle)
await page.fill('//input[@type="email"]', email)
Run Code Online (Sandbox Code Playgroud) 我正在使用 watir-webdriver 来自动化和测试应用程序。在此过程中,我需要单击下拉菜单并选择一个值,但是 watir 似乎无法选择该项目。请帮忙?
我的代码:
browser.text_field(:id => "user_username").set "#{username}"
browser.select_list(:id => 'user_date_of_birth_month').clear
puts browser.select_list(:id => 'user_date_of_birth_month').options
browser.select_list(:id => 'user_date_of_birth_month').select "9"
Run Code Online (Sandbox Code Playgroud)
HTML:
<label class="sc-font-light sc-text-light next-light-label" for="user_date_of_birth_month
2. When were you born?<span class="inline-help"><span class="content hidden">For information on why we ask for your date of birth, see <a href="http://help.soundcloud.com/customer/portal/articles/1481474-why-do-you-need-my-date-of-birth-" target="_blank">this help center article</a>.</span></span>
Run Code Online (Sandbox Code Playgroud)
<div class="width_1_2"><select id="user_date_of_birth_month"name="user[date_of_birth][month]">
<option value="">Month</option>
<option value="1">January</option>
<option value="2">February</option>
<option value="3">March</option>
<option value="4">April</option>
<option value="5">May</option>
<option value="6">June</option>
<option value="7">July</option>
<option value="8">August</option>
<option value="9">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option …
Run Code Online (Sandbox Code Playgroud) webautomation ×10
javascript ×5
node.js ×3
puppeteer ×3
e2e-testing ×2
playwright ×2
ruby ×2
selenium ×2
automation ×1
c# ×1
firefox ×1
java ×1
jestjs ×1
perl ×1
testcafe ×1
testing ×1
vb.net ×1
watir ×1