更新时间: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发行说明的相关字节:
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`.