我使用eclipse和firefox运行selenium webdriver。 我需要在Windows Server上部署并运行它。 所以我遵循了这些步骤:
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 Server上的这是firefox版本:57.0.4(64位)
答案 0 :(得分:1)
我通过在Windows Server上安装geckodriver来修复它,希望它将来会帮助某人:https://github.com/mozilla/geckodriver/releases。