Run chrome browser in inconginto Mode in Selenium

前端 未结 7 1595
忘掉有多难
忘掉有多难 2020-12-02 21:11

I want to run chrome in incongito mode through selenium. I googled enough for it and found how to run chrome directly in incongito mode with the h

相关标签:
7条回答
  • 2020-12-02 22:04
    System.setProperty("webdriver.chrome.driver", "path for chromedriver.exe");
    ChromeOptions options = new ChromeOptions();
    options.addArguments("incognito");
    DesiredCapabilities cap = DesiredCapabilities.chrome();
    cap.setCapability(ChromeOptions.CAPABILITY, options);
    WebDriver driver = new ChromeDriver(cap);
    driver.get("https://google.com");
    
    0 讨论(0)
提交回复
热议问题