After searching for many hours I am starting to think this is impossible.
I need to run Chrome through selenium using different authenticated (not public) proxy's for each run.
PROXY_IP = "<some IP address>"
UID = "<the user id>"
PWD = "<the password">
options = webdriver.ChromeOptions()
options.add_argument("--proxy-server=%s:%s@%s" % (UID,PWD,PROXY_IP))
driver = webdriver.Chrome(executable_path=".\\driver\\chromedriver.exe",
chrome_options=options)
driver.get("<site URL>")
Chrome will fire-up and display the error:
This webpage is not available
ERR_NO_SUPPORTED_PROXIES
If I use a public proxy requiring no authentication like this...
PROXY_IP = "<public proxy IP address>"
options = webdriver.ChromeOptions()
options.add_argument("--proxy-server=%s" % PROXY_IP)
driver = webdriver.Chrome(executable_path=".\\driver\\chromedriver.exe",
chrome_options=options)
driver.get("<site URL>")
...it runs just fine and displays the site while using the proxy.
I also tried a variant with http://
in front of the user ID:
options.add_argument("--proxy-server=http://%s:%s@%s" % (UID,PWD,PROXY_IP))
The fact that I have searched far and wide and haven't found a solution leads me to believe none might exist.
I did find this but I can't make sense out of it:
selenium chromedriver authentication proxy
Not sure what browswermob-proxy
is or is supposed to do or how to implement and test in Python. I hate piling up band-aid solutions unless they are absolutely necessary.
after trying many solutions that didn't actually work properly, i finally managed to set the authenticated proxy using the suggested extension from previous answers. what you need to do is to enter this link:
http://crxextractor.com/ and paste this url: https://www.crx4chrome.com/crx/1446/
It will let you download the extention as a .crx file without installing it. than i used this code:
I have checked for most of the solutions on the web and for none of them authentication via chrome/firefox desired capabilities is working. Check this link: https://github.com/webdriverio/webdriverio/issues/324. Finally the temporary solution is to whitelist your IP address with the proxy provider.
I could not find any solution for chrome. We can not add extensions with
headless
option. I am using Heroku with chrome-buildpack. There are following optionsxvfb
instead of headless options and install extensionInstead of these workaround I switched to Firefox where i was able to fill Username and Password on Proxy authentication Pop-up. Like given below. Following code is for Ruby using Capybara. You should be able to do something like this on your platform
THis is a temporary solution might work in initial state: Code is in Python: Download the plugin first from chrome plugin store : Proxy-Auto-Auth_v2.0.crx
I tryed lot of time to do the same.
Chrome is using only proxy of the OS where it is installed. You can check it by going to options-> find: proxy -> change proxy settings
So without additional addons and configuring this addons you cannot do this.
Or you can change your OS proxy settings -- this is much easier.
Also you can use phantomjs -- it have the same engine(WebKit) as chrome. using something like this: