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

前端 未结 2 1779
长情又很酷
长情又很酷 2021-01-15 03:57

I am using:

  • Selenium 4
  • python 3.7
  • Firefox webdriver

I need to verify the username and password for my current project. I\'ve b

相关标签:
2条回答
  • 2021-01-15 04:11

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

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

    And thanks to @pguardiario for your help..

    0 讨论(0)
  • 2021-01-15 04:18

    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)
    
    0 讨论(0)
提交回复
热议问题