Trying to initialize a Chrome Remote web driver using WebDriverManager, while passing ChromeOptions and a Selenium Grid standalone server URL using Java. From online examples; Passing Chrome options would look like this:
WebDriverManager.chromedriver().setup();
RemoteWebDriver remoteWebDriver = new ChromeDriver(options);
threadLocalDriver.set(remoteWebDriver);
Passing the hub URL for the selenium grid standalone server would look like this:
WebDriverManager.chromedriver().setup();
RemoteWebDriver remoteWebDriver = ((RemoteWebDriver) WebDriverManager
.chromedriver()
.remoteAddress(hubURL)
.create());
threadLocalDriver.set(remoteWebDriver);
How can I pass both to a RemoteWebDriver object?
Thanks
You need to use the method capabilities() for that:
ChromeOptions options = new ChromeOptions();
options.addArguments("--headless");
WebDriver driver = WebDriverManager.chromedriver()
.capabilities(options)
.remoteAddress(hubURL)
.create();
Also calling setup() is not needed as it is called by create() method.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.