0

如何使用 selenium web 驱动程序处理 chrome 浏览器中弹出的身份验证?

4

1 回答 1

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

于 2018-11-19T11:23:26.573 回答