且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

远程WebDriver UnreachableBrowserException:无法启动新的会话

更新时间:2023-01-18 19:22:11

错误说明了一切:

INFO: Using `new ChromeOptions()` is preferred to `DesiredCapabilities.chrome()`

调用 RemoteWebDriver Selenium 的当前实现支持ChromeOptions,您可以使用以下代码块:

The current implementation of Selenium while invoking RemoteWebDriver supports the ChromeOptions and you can use the following code block :

ChromeOptions options = new ChromeOptions();
options.addArguments("disable-infobars");
webDriver = new RemoteWebDriver(new URL("http://myIP:5555/wd/hub"), options);


更新

根据您的评论更新 seleniumhq文档上的文档更新.以下是 Selenium发行说明的相关字节:


Update

As per your comment update the documentation at seleniumhq-documentation is yet to be updated. Here are the relevant bytes from the Selenium Release Notes :

  • Selenium v​​3.5.0 :

* Start making *Option classes instances of Capabilities. This allows
  the user to do:
  `WebDriver driver = new RemoteWebDriver(new InternetExplorerOptions());`

  • Selenium v​​3.6.0 :

    * All `*Option` classes now extend `MutableCapbilities`
      `new RemoteWebDriver(new ChromeOptions());`
    

  • Selenium v​​3.7.0 :

    * Migrated from using `DesiredCapabilities` to either
      `MutableCapabilities` or (preferably) `ImmutableCapabilities`.