【发布时间】:2016-08-25 01:57:46
【问题描述】:
Firefox 似乎最近更新了,现在是 48.0 版,导致我的 -htmlSuite 测试失败。我从 Firefox 收到此错误消息:
Firefox can’t find the file at chrome://src/content/TestRunner.html
我目前正在使用 Selenium Server 版本 2.53.1 来运行我的测试,这些测试记录在 Firefox Selenium IDE 插件中,然后在我的 OS X 开发服务器上自动化。
这些测试的目的是提供任何网站的每日概要,以防脚本无法导航到网站购买工作流程的末尾。这是我为启动功能测试而编写的 bash 脚本:
#!/bin/bash
java -jar selenium-server-standalone-2.53.1.jar
-htmlSuite "*firefox" "http://www.insureone.com"
"/SeleniumTests/InsureOne-Suite.html"
"/SeleniumTests/InsureOne-Results.html" > /dev/null
java -jar selenium-server-standalone-2.53.1.jar
-htmlSuite "*firefox" "http://www.aaffordableauto.com"
"/SeleniumTests/A-Affordable-Suite.html"
"/SeleniumTests/A-Affordable-Results.html" > /dev/null
echo "Finished"
这是 InsureOne Suite 唯一测试的 sn-p,它浏览前两页:
InsureOne-Test
setTimeout 60000
open /
sendKeys id=zipcode 60610
sendKeys id=phone 3126548045
select id=year label=2006
waitForElementPresent //option[contains(.,'PONTIAC')]
select id=make label=PONTIAC
waitForElementPresent //option[contains(.,'G6')]
select id=model label=G6
clickAndWait //button[contains(.,'Free Quote')]
setTimeout 120000
waitForElementPresent id=getquote
setTimeout 60000
clickAndWait id=getquote
这些测试使用 Automator 运行,然后每天早上将结果通过电子邮件发送给我以供审核。
我最初尝试使用最新版本的 Selenium 来启动我的测试,但无法正常工作。我无法在 Selenium 文档中找到任何内容来帮助我使用最新版本的 Selenium 运行 html 测试套件。
我不希望在 Jenkins + Maven 或其他语言的等价物中运行的自动构建和正式单元测试增加复杂性。有没有办法通过 shell 脚本在 Selenium 3 中执行此操作?
java -jar selenium-server-standalone-3.0.0-beta2.jar
-htmlSuite "*firefox" "http://www.aaffordableauto.com"
"/SeleniumTests/A-Affordable-Suite.html"
"/SeleniumTests/A-Affordable-Results.html" > /dev/null
此命令会导致 NullPointerException。我被困住了,因为 SeleniumHQ 上没有关于如何使其工作或将其迁移到最新版本的建议。
【问题讨论】:
-
你可能想看看这个开放的错误:github.com/SeleniumHQ/selenium/issues/2616
-
我也尝试让它在 Firefox 开发者版上运行,将 xpinstall.signatures.required 设置为 false (support.mozilla.org/en-US/kb/…),但没有成功。它启动但由于某种原因测试套件文件是错误的。 java -jar selenium/selenium-server-standalone-2.53.1.jar -htmlSuite "*firefox /Applications/FirefoxDeveloperEdition.app/Contents/MacOS/firefox-bin" "baseURL" "/path/to/test/suite" " /结果/文件”
-
Selenium 开发人员告诉我,Selenium 3 Beta 3 将包含一个用于运行 htmlSuite 脚本的旧版 jar 文件。
标签: java bash unit-testing selenium