Gr1mReality
Gr1mReality

Reputation: 183

Problems with setting up proxy for chrome using selenium 3.8.1

I used to set up proxy on chrome like in a code below, but when i updated to selenium 3.8.1 proxy stops working, i dont get any errors it just doesn't use proxy server and i dont know why. My chromedriver is also up to date.

options = webdriver.ChromeOptions()
options.add_argument('--proxy-server=192.99.55.120:3128')
driver = webdriver.Chrome(executable_path='C:\chromedriver_win32\chromedriver.exe', chrome_options=options)
driver.get("http://google.com/")

Would like to receive any advice, maybe alternative way to set up proxy for chromedriver.

Upvotes: 4

Views: 5865

Answers (3)

Gr1mReality
Gr1mReality

Reputation: 183

If someone still interested, this is how i have finally solved the problem

from selenium.webdriver import Proxy
from selenium.webdriver.chrome.webdriver import WebDriver as ChromeDriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

settings = {
        "httpProxy": "192.99.55.120:3128",
        "sslProxy": "192.99.55.120:3128"
    }
proxy = Proxy(settings)

cap = DesiredCapabilities.CHROME.copy()
cap['platform'] = "WINDOWS"
cap['version'] = "10"
proxy.add_to_capabilities(cap)

driver = ChromeDriver(desired_capabilities=cap, executable_path='C:\chromedriver_win32\chromedriver.exe')

Upvotes: 5

Zouhair Kasmi
Zouhair Kasmi

Reputation: 662

If the navigator asks for the credentials username and password for the proxy and you need to handle this : (only if the alert come up)

driver.get("http://username:[email protected]/")

Upvotes: 0

Most Wanted
Most Wanted

Reputation: 6989

try

options.add_argument('--proxy-server="http=192.99.55.120:3128;https=192.99.55.120:3128"')

also try running your chrome binary directly with these params to see whether it works or not

chrome.exe --proxy-server="http=192.99.55.120:3128"

Upvotes: 3

Related Questions