Home > Software engineering >  How to set options when using browserInDocker() with WebDriverManager?
How to set options when using browserInDocker() with WebDriverManager?

Time:12-13

How can I set ChromeOptions on the driver when using .browserInDocker()? I want to set the option "--disable-dev-shm-usage" and using Docker the recommended call is:

WebDriver driver = WebDriverManager.chromedriver()
                                   .browserInDocker()
                                   .create()

However, it looks like WebDriverManager or WebDriverManager.chromedriver() do not have a way to set ChromeOptions.

So, how can I set extra options using WebDriverManager in Docker?

CodePudding user response:

You need to use the method capabilities() for that:

ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-dev-shm-usage");
WebDriver driver = WebDriverManager.chromedriver()                        
                                   .capabilities(options)
                                   .browserInDocker()
                                   .create();
  • Related