身份验证弹出Chrome浏览器

时间:2018-11-02 14:13:04

标签: selenium-webdriver selenium-chromedriver ui-automation browser-automation selenium3

如何使用Selenium Web驱动程序处理Chrome浏览器中弹出的身份验证?

1 个答案:

答案 0 :(得分:0)

尝试:

  WebDriver driver =  new ChromeDriver(options)
  driver.get("http://username:password@www.domain.com");

ChromeOptions options = new ChromeOptions();
options.addArguments("user-data-dir=/path/to/your/custom/profile");
WebDriver driver =  new ChromeDriver(options);
driver.navigate().to(testURL);

参考文献:

https://sites.google.com/a/chromium.org/chromedriver/capabilities https://chromium.googlesource.com/chromium/src/+/master/docs/user_data_dir.md