6

I am using:

  • Selenium 4
  • python 3.7
  • Firefox webdriver

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.

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()

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.

Markus
  • 3,155
  • 2
  • 23
  • 33
Fazıl Akbulut
  • 198
  • 2
  • 14

1 Answers1

2

To use proxies with auth in python selenium you can use seleniumwire.

Fistly, install it with pip install selenium-wire

Then import webdriver from seleniumwire instead selenium

Check the original Answer here

    from seleniumwire import webdriver
options = {
    'proxy': {
        'http': 'http://username:password@host:port', 
        'https': 'https://username:password@host:port',
        'no_proxy': 'localhost,127.0.0.1' # excludes
    }
}
browser = webdriver.Chrome(path_to_driver, seleniumwire_options=options)
Taha Daboussi
  • 350
  • 3
  • 14
  • 3
    after alot of time searching why selenium is being very slow to load a page (15 sec) it turned out the problem was from seleniumwire, if your operation is time sensitive look for another solution – Taha Daboussi Jan 26 '21 at 08:28