How to Set Proxy for Chrome in Python Webdriver

Python Selenium Proxy in Chrome

There's nothing wrong with your code. That proxy is just not available/not working anymore.
Try to find another proxy that a better uptime. Keep it mind that public proxies have a noticeable latency so the page will load pretty slow.

Sample Image

Failing to set up proxy for chrome in Selenium (Python 3.7)

Below is the correct way to add proxy in chrome ,

JAVA:

ChromeOptions chromeOptions = new ChromeOptions();
String proxyadd = "176.9.119.170:8080";
Proxy proxy = new Proxy();
proxy.setHttpProxy(proxyadd);
proxy.setSslProxy(proxyadd);
chromeOptions.setCapability("proxy", proxy);
WebDriver driver = new ChromeDriver(chromeOptions);

PYTHON:

from selenium import webdriver

PROXY="176.9.119.170:8080"
webdriver.DesiredCapabilities.CHROME['proxy'] = {
"httpProxy": PROXY,
"ftpProxy": PROXY,
"sslProxy": PROXY,
"proxyType": "MANUAL",

}

webdriver.DesiredCapabilities.CHROME['acceptSslCerts']=True

driver =webdriver.Chrome(r".\chromedriver.exe")


driver.get("https://www.google.com")

It seems that chrome is not able to connect to proxy may be it is using system proxy. Try above mentioned approach to set proxy

How to use chomedriver with a proxy for selenium webdriver?

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

--proxy-server=:



Related Topics



Leave a reply



Submit