Pass driver ChromeOptions and DesiredCapabilities?

后端 未结 5 1403
盖世英雄少女心
盖世英雄少女心 2020-12-05 05:19

The new Google chrome update causes this message in the browser \"You are using an unsupported command-line flag: --ignore-certificate-errors. Stability and security will su

5条回答
  •  醉梦人生
    2020-12-05 06:07

    I was fighting the same problem, and I finally cracked it. Basically, you can add ChromeOptions to DesiredCapabilities then create the driver with the DesiredCapabilities. Once I tried it, it got rid of the banner. Anyway, here is the code:

    DesiredCapabilities capabilities = DesiredCapabilities.chrome();
    ChromeOptions options = new ChromeOptions();
    options.addArguments("test-type");
    capabilities.setCapability("chrome.binary", "");
    capabilities.setCapability(ChromeOptions.CAPABILITY, options);
    webDriver = new ChromeDriver(capabilities);
    

提交回复
热议问题