Selenium - 页面从不在 windows 服务器上加载
Selenium - page never loads on windows server
我正在使用 Eclipse 和 Firefox 运行ning selenium webdriver。
我需要在 windows 服务器上部署并 运行 它。
所以我遵循了这些步骤:
- 导出了一个可执行 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位)
我通过在 Windows 服务器上安装 geckodriver 来修复它,希望它能对以后的人有所帮助:https://github.com/mozilla/geckodriver/releases.
我正在使用 Eclipse 和 Firefox 运行ning selenium webdriver。 我需要在 windows 服务器上部署并 运行 它。 所以我遵循了这些步骤:
- 导出了一个可执行 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位)
我通过在 Windows 服务器上安装 geckodriver 来修复它,希望它能对以后的人有所帮助:https://github.com/mozilla/geckodriver/releases.