How to use chomedriver with a proxy for selenium webdriver?

别来无恙 提交于 2019-12-04 10:15:35

Its possible for Chrome to be started with command lines with selenium web driver. The command line for the proxy is:

--proxy-server=:

I'll save someone from the pain. If you have proxy server that requires you to pass username/pw then it's not possible to pass it through the url itself directly.

I wanted to get it work with Proxymesh so what I did, went to control panel and whitelisted my machine so it wouldn't require username/pw for my computer.

more @ https://github.com/webdriverio/webdriverio/issues/324

Its working for me...

from selenium import webdriver

PROXY = "23.23.23.23:3128" # IP:PORT or HOST:PORT

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--proxy-server=http://%s' % PROXY)

chrome = webdriver.Chrome(chrome_options=chrome_options)
chrome.get("http://whatismyipaddress.com")
Chirag

This is working for me. please you can try.

from selenium import webdriver

PROXY = "23.23.23.23:3128" # IP:PORT or HOST:PORT

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--proxy-server=http://%s' % PROXY)

chrome = webdriver.Chrome(chrome_options=chrome_options)
chrome.get("http://whatismyipaddress.com")
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!