Passing options to chrome driver selenium

后端 未结 4 1743
北恋
北恋 2020-12-31 12:56

I am trying to disable the output to the console for chrome. If I pass the --start-maximized option it works fine. I may have the wrong command?

DesiredCapab         


        
4条回答
  •  一整个雨季
    2020-12-31 13:09

    As of Selenium 3 at least, you can use ChromeDriverService and its inner class Builder to be able to launch the driver in silent mode.

    A oneliner for that:

    new ChromeDriver(new ChromeDriverService.Builder().withSilent(true).build());
    

    The constructor is straight-forward, you create a new service builder setting silent to true (that's the critical part) and you finally build it into a ChromeDriverService which is required by ChromeDriver's constructor.

提交回复
热议问题