Remote WebDriver UnreachableBrowserException: Could not start a new session

前端 未结 1 664
余生分开走
余生分开走 2020-12-21 17:46

I got this exception for all browsers. For example, I create a remote webdriver on chrome like this:

caps = DesiredCapabilities.chrome();
ChromeOptions optio         


        
相关标签:
1条回答
  • 2020-12-21 18:16

    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`.
      
    0 讨论(0)
提交回复
热议问题