org.openqa.selenium.WebDriverException: Error loading page error with Selenium 3.0.1 GeckoDriver 0.13 and Firefox 46.0

huangapple go评论89阅读模式
英文:

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,但其他依赖项可以更改。有人在以前遇到过这个问题吗?

  1. 1676503488636 geckodriver INFO 127.0.0.1:12651 上进行监听
  2. 2023215 下午3:24:48 org.openqa.selenium.remote.ProtocolHandshake createSession
  3. INFO: 尝试双语言会话,假设远程端遵循Postel's Law
  4. 1676503488712 mozprofile::profile INFO 使用配置文件路径 /tmp/rust_mozprofile.gQ6hEnrnMxIC
  5. 1676503488713 geckodriver::marionette INFO 启动浏览器 /home/robert/firefox/firefox-bin
  6. 1676503488714 geckodriver::marionette INFO 连接到本地主机的Marionette:36313
  7. 1676503489262 Marionette INFO 在端口36313上进行监听
  8. 2023年2月15日 下午3:24:50 org.openqa.selenium.remote.ProtocolHandshake createSession
  9. INFO: 检测到方言:W3C
  10. org.openqa.selenium.WebDriverException: 错误加载页面
  11. 构建信息: 版本: 'unknown', 修订版本: 'unknown', 时间: 'unknown'
  12. 系统信息: 主机: 'robert-XPS-8700', IP: '127.0.1.1', 操作系统名称: 'Linux', 操作系统架构: 'amd64', 操作系统版本: '5.15.0-58-generic', Java版本: '1.8.0_202'
  13. 驱动信息: org.openqa.selenium.firefox.FirefoxDriver
  14. 功能 [{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}]
  15. 会话ID: 918b2a1b-0b33-4acf-ae5a-8545c55ad0d9
  16. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  17. at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
  18. at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  19. at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
  20. at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:127)
  21. at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:93)
  22. at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:42)
  23. at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:163)
  24. at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
  25. at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
  26. at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:322)
  27. at shef.main.RLGExtractor.extract(RLGExtractor.java:105)
  28. at shef.main.Tool.runFaultDetector(Tool.java:185)
  29. at shef.main.Tool.<init>(Tool.java:136)
  30. 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?

  1. 1676503488636 geckodriver INFO Listening on 127.0.0.1:12651
  2. Feb 15, 2023 3:24:48 PM org.openqa.selenium.remote.ProtocolHandshake createSession
  3. INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
  4. 1676503488712 mozprofile::profile INFO Using profile path /tmp/rust_mozprofile.gQ6hEnrnMxIC
  5. 1676503488713 geckodriver::marionette INFO Starting browser /home/robert/firefox/firefox-bin
  6. 1676503488714 geckodriver::marionette INFO Connecting to Marionette on localhost:36313
  7. 1676503489262 Marionette INFO Listening on port 36313
  8. Feb 15, 2023 3:24:50 PM org.openqa.selenium.remote.ProtocolHandshake createSession
  9. INFO: Detected dialect: W3C
  10. org.openqa.selenium.WebDriverException: Error loading page
  11. Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
  12. 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'
  13. Driver info: org.openqa.selenium.firefox.FirefoxDriver
  14. 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}]
  15. Session ID: 918b2a1b-0b33-4acf-ae5a-8545c55ad0d9
  16. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  17. at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
  18. at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  19. at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
  20. at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:127)
  21. at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:93)
  22. at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:42)
  23. at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:163)
  24. at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
  25. at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
  26. at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:322)
  27. at shef.main.RLGExtractor.extract(RLGExtractor.java:105)
  28. at shef.main.Tool.runFaultDetector(Tool.java:185)
  29. at shef.main.Tool.<init>(Tool.java:136)
  30. 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,如下所示:

  1. cap = DesiredCapabilities().FIREFOX
  2. cap["marionette"] = False

参考资料

您可以在以下链接找到一些相关的详细讨论:

英文:

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:

  1. cap = DesiredCapabilities().FIREFOX
  2. cap["marionette"] = False

References

You can find a couple of relevant detailed discussions in:

huangapple
  • 本文由 发表于 2023年2月18日 02:12:03
  • 转载请务必保留本文链接:https://go.coder-hub.com/75487898.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定