Selenium Using Python: Enter/Provide Http Proxy Password for Firefox

How to use a socks5 proxy with authentication via selenium 4, Python and Firefox (options)

It looks like Firefox does not accept user/password auth for socks5 proxy at this time, see: https://github.com/mozilla/geckodriver/issues/1872

The bug/feature is being tracked here: https://bugzilla.mozilla.org/show_bug.cgi?id=1395886

Selenium is aware of this issue here: https://github.com/SeleniumHQ/selenium/issues/7911

For now the solution I've used as an alternative is to use no authentication on my proxy and then use ufw on the server to block all IPs except for the designated ones.

Python selenium - Proxy connection with host, port, username, password

Dup of: How to set proxy AUTHENTICATION username:password using Python/Selenium

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

Install selenium-wire

pip install selenium-wire

Import it

from seleniumwire import webdriver

Auth to proxy

options = {
'proxy': {
'http': 'http://username:password@host:port',
'https': 'https://username:password@host:port',
'no_proxy': 'localhost,127.0.0.1,dev_server:8080'
}
}
driver = webdriver.Firefox(seleniumwire_options=options)

Warning
Take a look to the selenium-wire cache folder. I had a problem because it take all my disk space. You have to remove it sometimes in your script when you want.



Related Topics



Leave a reply



Submit