我正在尝试使用Selenium和java执行测试用例,但页面没有完全加载,我在eclipse控制台中收到此消息:
无法阅读VR路径注册表
这条消息是什么意思?
以下是代码:
FirefoxDriver driver = new FirefoxDriver();
try {
driver.get(url);
WebDriverWait wait = new WebDriverWait(driver, 10);
driver.manage().timeouts().pageLoadTimeout(10, TimeUnit.SECONDS);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id(idName)));
...
这是控制台:
1513781293556 Marionette INFO Enabled via --marionette
Unable to read VR Path Registry from C:\Users\jo\AppData\Local\openvr\openvrpaths.vrpath
[Parent 12932, 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\jo\AppData\Local\openvr\openvrpaths.vrpath
[Child 8784, Chrome_ChildThread] WARNING: pipe error: 109: file z:/build/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 346
[Child 8784, Chrome_ChildThread] WARNING: pipe error: 109: file z:/build/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 346
1513781295106 Marionette INFO Listening on port 54019
1513781295991 Marionette WARN TLS certificate errors will be ignored for this session
1513781296065 Marionette DEBUG Register listener.js for window 4294967297
dic 20, 2017 3:48:16 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
1513781296124 Marionette DEBUG Received DOM event "beforeunload" for "about:blank"
1513781297500 Marionette DEBUG Received DOM event "pagehide" for "about:blank"
1513781297501 Marionette DEBUG Received DOM event "unload" for "about:blank"
1513781306755 Marionette DEBUG Received DOM event "pageshow" for "[URL]"
1513781311436 Marionette DEBUG Received DOM event "DOMContentLoaded" for "[URL]"
Unable to read VR Path Registry from C:\Users\jo\AppData\Local\openvr\openvrpaths.vrpath
JavaScript warning: [URL]_Incapsula_Resource?SWJIYLWA=719d34d31c8e3a6e6fffd425f7e032f3&ns=46&cb=1899153169, line 1: unreachable code after return statement
JavaScript warning:[URL]?SWJIYLWA=719d34d31c8e3a6e6fffd425f7e032f3&ns=46&cb=1899153169 line 1 > eval, line 1: unreachable code after return statement
1513781320494 Marionette DEBUG Received DOM event "pageshow" for "https://www.url.it/it/adesione?zoneid=home-box_offerta#!"
1513781321091 Marionette DEBUG Register listener.js for window 4294967317
test failure Expected condition failed: waiting for visibility of element located by By.id: ITA_IFM_First_Name__c (tried for 10 second(s) with 500 MILLISECONDS interval)
Unable to read VR Path Registry from C:\Users\jo\AppData\Local\openvr\openvrpaths.vrpath
[Child 2004, Chrome_ChildThread] WARNING: pipe error: 109: file z:/build/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 346
[Child 2004, Chrome_ChildThread] WARNING: pipe error: 109: file z:/build/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 346
测试另一个网站,Firefox没有这样的问题。
答案 0 :(得分:1)
从here下载所需的gecodriver
版本。并按如下所示初始化您的firefox
驱动程序:
System.setProperty("webdriver.gecko.driver", "/PATH/TO/geckodriver.exe");
FirefoxDriver driver = new FirefoxDriver();
答案 1 :(得分:1)
我发现了同样的问题,并且使用旧的gecko驱动程序(即V0.19.1)解决了这个问题。我最近使用的是gecko驱动程序v0.20.0
答案 2 :(得分:0)
无法阅读VR路径注册表
这不是造成你失败的原因。
有明确的错误消息说明:
test failure Expected condition failed: waiting for visibility of element located by By.id: ITA_IFM_First_Name__c
您正在等待具有ID" ITA_IFM_First_Name__c" ...的元素的可见性,这在到达超时之前不会出现。
答案 3 :(得分:0)
我之前发现了同样的问题但是目前使用geckodriver-v0.19.1后发现没有发现任何问题。
答案 4 :(得分:-1)
//set geckodriver path
System.setProperty("webdriver.gecko.driver","C:\\geckodriver.exe");
// Suppress logs with warning
System.setProperty(FirefoxDriver.SystemProperty.BROWSER_LOGFILE,"/dev/null");
// initialize Firefox driver object to open Firefox browser
WebDriver driver = new FirefoxDriver();