如何使用Python/Selenium设置代理身份验证用户名:密码 [英] How to set proxy AUTHENTICATION username:password using Python/Selenium

查看:325
本文介绍了如何使用Python/Selenium设置代理身份验证用户名:密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用:

  • 硒4
  • python 3.7
  • Firefox网络驱动程序

我需要验证当前项目的用户名和密码.我已经白天和黑夜都工作了几天,但我解决不了这个问题.我在互联网上找到了一些扩展名,但这是从13年开始的,我想这就是为什么它不起作用的原因.您还可以在下面看到我尝试过的其他方法.

I need to verify the username and password for my current project. I've been working day and night for days and I can't solve this problem. I've found a few extension on the internet, but it's from '13 year and I guess that's why it doesn't work. You can also see other methods I've tried below.

但是不起作用,因为由于Selenium错误,代理身份验证不再起作用.

But doesn't work, because Proxy Authentication is not working anymore due to the Selenium bug..

alert_popup = browser.switch_to_alert()
    alert_popup.send_keys(
        "{username}{tab}{password}{tab}".format(
            username=proxy_username, tab=Keys.TAB, password=proxy_password
    )
)
alert_popup.accept()

我想创建一个配置文件并手动保存代理信息,并使用该配置文件启动selenium.但是,firefox不允许手动输入用户名和密码.

I wanted to create a profile and save the proxy information manually and start selenium with that profile. However, firefox does not allow user name and password to be entered manually.

推荐答案

我们使用Selenium库解决了此问题.希望它对您的业务有益.硒丝

We solved this problem with a library for Selenium. Hopefully it benefits your business. Selenium Wire

https://github.com/wkeeling/selenium-wire

感谢@pguardiario的帮助.

And thanks to @pguardiario for your help..

这篇关于如何使用Python/Selenium设置代理身份验证用户名:密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆