user:pass proxies with selenium

后端 未结 2 967
夕颜
夕颜 2020-12-17 03:41

What is the best/easiest way to use user authenticated proxies in a program? I currently have this but I need username and password to be already filled in when browser open

相关标签:
2条回答
  • 2020-12-17 04:21

    You can achieve the same using a Proxy Auto auth plugin

    from selenium import webdriver
    
    options = webdriver.ChromeOptions()
    PROXY = "185.136.232.243:80"
    options.add_extension("~/Downloads/Proxy Auto Auth.crx")
    options.add_argument("--proxy-server=http://{}".format(PROXY))
    
    driver = webdriver.Chrome(chrome_options=options)
    
    driver.get("chrome-extension://ggmdpepbjljkkkdaklfihhngmmgmpggp/options.html")
    
    driver.find_element_by_id("login").send_keys("user")
    driver.find_element_by_id("password").send_keys("password")
    driver.find_element_by_id("retry").clear()
    driver.find_element_by_id("retry").send_keys("2")
    
    
    driver.find_element_by_id("save").click()
    
    driver.get("http://tarunlalwani.com")
    

    Download the extension using below extensions

    https://chrome.google.com/webstore/detail/get-crx/dijpllakibenlejkbajahncialkbdkjc/related https://chrome.google.com/webstore/detail/proxy-auto-auth/ggmdpepbjljkkkdaklfihhngmmgmpggp?utm_source=gmail

    0 讨论(0)
  • 2020-12-17 04:37

    I used Proxy Auto Auth with head chrome successfully,but headless chrome is fail。

    selenium.common.exceptions.WebDriverException: Message: unknown error: failed to wait for extension background page to load: chrome-extension://ggmdpepbjljkkkdaklfihhngmmgmpggp/_generated_background_page.html from unknown error: page could not be found: chrome-extension://ggmdpepbjljkkkdaklfihhngmmgmpggp/_generated_background_page.html

    0 讨论(0)
提交回复
热议问题