【问题标题】:Entering basic auth popup info with python and chrome > 59使用 python 和 chrome > 59 输入基本身份验证弹出信息
【发布时间】:2018-02-22 21:02:13
【问题描述】:

我正在尝试为 chromedriver 设置具有基本身份验证的代理,我在 EC2 节点上设置了一个正常工作的 squid 代理。找到如下代码(稍作修改)

    driver = webdriver.Chrome(executable_path=CHROMEDRIVER_PATH, options=options)

    driver.get("https://yahoo.com")
    wait = WebDriverWait(driver, 10)
    alert = wait.until(EC.alert_is_present())
    alert = driver.switch_to(alert)
    alert.send_keys('myname')
    alert.send_keys(Keys.TAB)
    alert.send_keys('mypass')
    alert.accept()

但是 auth Box 没有被填充。我怎样才能让它工作?

编辑,这不是重复的问题。我正在使用 chrome 64 和 chromedriver。不是火狐。我也在使用代理(不在另一个问题中)我尝试了接受的答案,但它不起作用。显然 chrome 59 以上的任何东西都不允许这种方法 (Chrome 59 and Basic Authentication with Selenium/Fluentlenium)。

【问题讨论】:

标签: python google-chrome selenium selenium-webdriver selenium-chromedriver


【解决方案1】:

最简单的解决方案是将网址构建为:

http://username:password@url

【讨论】:

    猜你喜欢
    • 2017-11-16
    • 2013-05-16
    • 2017-11-26
    • 1970-01-01
    • 2019-04-06
    • 2018-09-14
    • 2011-01-28
    • 1970-01-01
    • 2011-03-22
    相关资源
    最近更新 更多