【发布时间】:2018-01-19 17:35:15
【问题描述】:
我正在使用 eclipse 和 firefox 运行 selenium webdriver。 我需要在 Windows Server 上部署和运行它。 所以我遵循了这些步骤:
- 导出了一个可执行的 jar
- 创建一个运行它的run.bat:
java.exe -jar SeleniumTestAutomation.jar - 运行它
问题是 gecko 驱动程序可以运行 firefox,但它似乎从未加载我的测试用例的主页,如下所示:
这是控制台消息:
1516381435343 geckodriver INFO geckodriver 0.19.1
1516381435343 geckodriver INFO Listening on 127.0.0.1:2703
1516381436031 mozrunner::runner INFO Running command: "C:\\Program Fi
les\\Mozilla Firefox\\firefox.exe" "-marionette" "-profile" "C:\\Users\\srvadm\\
AppData\\Local\\Temp\\4\\rust_mozprofile.3hIE5DahwYIE"
1516381436531 Marionette INFO Enabled via --marionette
Unable to read VR Path Registry from C:\Users\srvadm\AppData\Local\openvr\openvr
paths.vrpath
[Parent 8272, Gecko_IOThread] WARNING: pipe error: 109: file z:/build/build/src/
ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 346
Unable to read VR Path Registry from C:\Users\srvadm\AppData\Local\openvr\openvr
paths.vrpath
[Child 8540, Chrome_ChildThread] WARNING: pipe error: 109: file z:/build/build/s
rc/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 346
[Child 8540, Chrome_ChildThread] WARNING: pipe error: 109: file z:/build/build/s
rc/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 346
1516381437997 Marionette INFO Listening on port 53261
1516381438108 Marionette WARN TLS certificate errors will be ignored f
or this session
1516381438164 Marionette DEBUG Register listener.js for window 42949672
97
Jan 19, 2018 5:03:58 PM org.openqa.selenium.remote.ProtocolHandshake createSessi
on
INFO: Detected dialect: W3C
请问为什么会出现这种情况以及如何解决?
这是我的测试用例的代码:
Log.startTestCase(tc);
FirefoxDriver driver = new FirefoxDriver();
try {
DateFormat dateFormat = new SimpleDateFormat("yy-MM-dd HH-mm-ss");
...
Log.info("recupera il driver del browser");
String urlHp = "https://www.gewiss.com/ww/it";
// vai su url da testare
driver.get(urlHp);
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
// click su contatti
driver.findElement(By.xpath("//*[@id='topbar']/div/div[2]/div[1]/ul/li[1]")).click();
// bottone inviaci un messaggio
driver.findElement(By.xpath("//*[@id='content']/div[2]/div[1]/div/div/div[2]/a")).click();
} catch (Exception e) {
Log.info("Exception: " + e.getClass() + " " + e.getMessage());
}
Log.endTestCase(tc);
它在 Windows 10 上完美运行。
在 windows 服务器上,这是 firefox 版本:57.0.4(64 位)
【问题讨论】:
-
我没有看到任何这样的错误,
INFO: Detected dialect: W3C一切都很好 -
检查Windows服务器上的Firefox和geckodriver版本是否与Windows 10相同。或者确保Windows服务器上的Firefox和geckodriver至少兼容。
标签: java eclipse selenium windows-server-2012