Remote WebDriver UnreachableBrowserException: Could not start a new session

限于喜欢 提交于 2019-11-29 16:30:07

The error says it all :

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

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);

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 v3.5.0 :

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

    * All `*Option` classes now extend `MutableCapbilities`
      `new RemoteWebDriver(new ChromeOptions());`
    
  • Selenium v3.7.0 :

    * Migrated from using `DesiredCapabilities` to either
      `MutableCapabilities` or (preferably) `ImmutableCapabilities`.
    
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!