有谁知道如何使用google chrome中的selenium webdriver来处理浏览器身份验证弹出窗口(公司web策略)?注意:我使用的是Linux-Cent OS7。我试着使用"http://username:password@example.com/yourpage",并使用AutoIT自动化,但由于它是linux操作系统,AutoIt不能工作。不会生成错误日志。
具体如下: OS: Linux - Cent OS-7。Google Chrome版本: 62 Selenium-Java版本: 3.9.0
谢谢。
发布于 2018-05-03 10:40:10
我仍然不知道如何处理Chrome的浏览器认证弹出窗口(在我的例子中,我使用的是Chrome 63)。我可以用Firefox解决这个问题:
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Firefox()
driver.get('https://<host>:<port>/<something>')
alert = driver.switch_to.alert
alert.send_keys('<username>' + Keys.TAB + '<password>')
alert.accept()
time.sleep(5)
print(driver.title)
driver.quit()https://stackoverflow.com/questions/48718921
复制相似问题