当我使用一个工具试图通过Selenium、gekodriver和firefox加载本地保存的网页时,我总是遇到这个错误。
selenium :3.0.1
Gekodriver:13.0版本
火狐浏览器:46.0
我的限制是我必须使用Selenium 3.0.1,但是其他依赖项可以更改。以前有人遇到过这个问题吗?
1676503488636 geckodriver INFO Listening on 127.0.0.1:12651
Feb 15, 2023 3:24:48 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
1676503488712 mozprofile::profile INFO Using profile path /tmp/rust_mozprofile.gQ6hEnrnMxIC
1676503488713 geckodriver::marionette INFO Starting browser /home/robert/firefox/firefox-bin
1676503488714 geckodriver::marionette INFO Connecting to Marionette on localhost:36313
1676503489262 Marionette INFO Listening on port 36313
Feb 15, 2023 3:24:50 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
org.openqa.selenium.WebDriverException: Error loading page
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'robert-XPS-8700', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '5.15.0-58-generic', java.version: '1.8.0_202'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{rotatable=false, raisesAccessibilityExceptions=false, marionette=true, firefoxOptions={args=[], prefs={}}, appBuildId=20160421124000, version=, platform=LINUX, proxy={}, specificationLevel=1, acceptSslCerts=false, browserVersion=46.0, platformVersion=5.15.0-58-generic, XULappId={ec8030f7-c20a-464f-9b0e-13a3a9e97384}, browserName=Firefox, takesScreenshot=true, takesElementScreenshot=true, platformName=Linux, device=desktop}]
Session ID: 918b2a1b-0b33-4acf-ae5a-8545c55ad0d9
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:127)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:93)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:42)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:163)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:322)
at shef.main.RLGExtractor.extract(RLGExtractor.java:105)
at shef.main.Tool.runFaultDetector(Tool.java:185)
at shef.main.Tool.<init>(Tool.java:136)
at shef.main.Tool.main(Tool.java:417)
1条答案
按热度按时间bvjxkvbb1#
根据geckodriver规范,Selenium用户必须更新到3.11或更高版本,才能像遵循W3C WebDriver specification的其他客户端一样使用geckodriver,并且也受支持。
此外,Firefox 57及更高版本对GeckoDriver的支持最佳,但Firefox版本越新,体验越好,因为它们包含更多的错误修复和最新功能,而某些功能仅在最新的Firefox Nightly(带 GeckoDriver)中可用。
此用例
如果您使用的是旧版Firefox(即 Firefox 47.x 之前的版本),geckodriver仍然有效,但您必须显式地将属性
"marionette"
设置为false
,如下所示: