如何使用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..