I am coding a test suite using Python and the Selenium library. Using the chromedriver, I am setting proxies using:
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--proxy-server=%s' % hostname + ":" + port)
global driver
driver = webdriver.Chrome(chrome_options=chrome_options)
This works fine when the proxy does not have authentication. However, if the proxy requires you to login with a username and password it will not work. What is the correct and proper way to pass proxy authentication information to the chromedriver using add_argument or other methods?
It is not the same as: How to set Proxy setting for Chrome in Selenium Java
Seeing as:
- I ts a different language
- Its firefox, not chrome.
- --proxy-server=http://user:password@proxy.com:8080 does not work.
Use
DesiredCapabilities
. I have been successfully using proxy authentication with the following:EDIT: it unfortunately seems this method no longer works since one of the updated to either Selenium or Chrome since this post. as of now, i do not know another solution, but i will experiment and update this if i find anything out.