Pass driver ChromeOptions and DesiredCapabilities?

后端 未结 5 1418
盖世英雄少女心
盖世英雄少女心 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 05:54

    public void setUp() throws Exception
    {
        System.out.println("Launching Google browser");
        System.setProperty("webdriver.chrome.driver", "C:\\chromedriver.exe");   
    
        ChromeOptions options = new ChromeOptions();
        options.addArguments("disable-infobars");
        Map prefs = new HashMap();
        prefs.put("profile.default_content_setting_values.automatic_downloads", 1);
        options.setExperimentalOption("prefs", prefs);
        prefs.put("download.default_directory", "C:\\Downloads");
        driver = new ChromeDriver(options);
        driver.manage().timeouts().implicitlyWait(100, TimeUnit.SECONDS);
        driver.manage().window().maximize(); 
    }
    

提交回复
热议问题