英文:
org.openqa.selenium.WebDriverException: Error loading page error with Selenium 3.0.1 GeckoDriver 0.13 and Firefox 46.0
问题
我在使用一个工具时一直遇到这个错误,该工具尝试通过Selenium、gekodriver和firefox加载本地保存的网页。使用的版本如下:
- Selenium: 3.0.1
- Gekodriver: 13.0
- Firefox: 46.0
我的约束是必须使用selenium 3.0.1,但其他依赖项可以更改。有人在以前遇到过这个问题吗?
1676503488636 geckodriver INFO 在 127.0.0.1:12651 上进行监听
2023年2月15日 下午3:24:48 org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: 尝试双语言会话,假设远程端遵循Postel's Law
1676503488712 mozprofile::profile INFO 使用配置文件路径 /tmp/rust_mozprofile.gQ6hEnrnMxIC
1676503488713 geckodriver::marionette INFO 启动浏览器 /home/robert/firefox/firefox-bin
1676503488714 geckodriver::marionette INFO 连接到本地主机的Marionette:36313
1676503489262 Marionette INFO 在端口36313上进行监听
2023年2月15日 下午3:24:50 org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: 检测到方言:W3C
org.openqa.selenium.WebDriverException: 错误加载页面
构建信息: 版本: 'unknown', 修订版本: 'unknown', 时间: 'unknown'
系统信息: 主机: 'robert-XPS-8700', IP: '127.0.1.1', 操作系统名称: 'Linux', 操作系统架构: 'amd64', 操作系统版本: '5.15.0-58-generic', Java版本: '1.8.0_202'
驱动信息: org.openqa.selenium.firefox.FirefoxDriver
功能 [{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}]
会话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)
英文:
I keep running into this error when using a tool that attempts to load a locally-saved web page via Selenium, gekodriver, and firefox.
Versions utilized:
- Selenium: 3.0.1
- Gekodriver: 13.0
- Firefox: 46.0
My constraints are that I have to use selenium 3.0.1, but the other dependencies can be altered. Has anybody run into this issue before?
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
得分: 1
根据geckodriver规格,Selenium用户必须升级到版本3.11或更高版本才能像遵循W3C WebDriver规范并得到支持的其他客户端一样使用geckodriver。
此外,对于GeckoDriver,Firefox 57及更高版本支持最佳,但Firefox版本越新,体验就越好,因为其中包含了更多的错误修复和最新功能,尽管一些功能只在最新的Firefox Nightly与_GeckoDriver_中可用。
这个用例
如果您使用旧版Firefox(即Firefox 47.x之前),geckodriver仍然有效,但您必须明确将属性 "marionette" 设置为 false
,如下所示:
cap = DesiredCapabilities().FIREFOX
cap["marionette"] = False
参考资料
您可以在以下链接找到一些相关的详细讨论:
- selenium.common.exceptions.SessionNotCreatedException: Message: Unable to find a matching set of capabilities with Firefox 46 through Selenium
- How can Geckodriver/Firefox work without Marionette? (running python selenium 3 against FF 53)
英文:
As per the geckodriver specifications Selenium users must update to version 3.11 or later to use geckodriver like other clients that follow the W3C WebDriver specification and are also supported.
Additionally, support for GeckoDriver is best in Firefox 57 and greater, however the more recent the Firefox version, the better the experience as they contain more bug fixes and the recent features while some features will only be available in the latest Firefox Nightly with GeckoDriver.
This usecase
If you are working with the legacy Firefox releases (i.e. till Firefox 47.x) geckodriver still works but you have to explicitly set the property "marionette"
to false
as follows:
cap = DesiredCapabilities().FIREFOX
cap["marionette"] = False
References
You can find a couple of relevant detailed discussions in:
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论