Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 862
Gr1mReality Avatar asked Oct 30 '25 05:10

Gr1mReality


2 Answers

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')
like image 95
Gr1mReality Avatar answered Oct 31 '25 20:10

Gr1mReality


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"
like image 33
Most Wanted Avatar answered Oct 31 '25 18:10

Most Wanted



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!