0

I'm trying to use Selenium with chrome driver and connect to websites using proxy, but for some odd reason chrome gives back an error, that either connection was reset or connection timed out or this site cant be reached and so on.. used many proxies, so I doubt that the proxy server is at fault.

Here's my code:

from selenium import webdriver

chromedriver = r'C:/Users\seife\Documents\chromedriver\chromedriver.exe'
PROXY = "177.202.59.58:8080"
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--proxy-server=%s' % PROXY)
chrome = webdriver.Chrome(chromedriver, options=chrome_options)
chrome.get("http://whatismyipaddress.com")

Here's how the page looks:

Chrome error page

1 Answer 1

2
#you need to import Options 
from selenium.webdriver.chrome.options import Options
from selenium import webdriver

chromedriver = r'C:/Users\seife\Documents\chromedriver\chromedriver.exe'
PROXY = "177.202.59.58:8080"  #free proxies sometimes don't work, I tried with netherland's proxy, and it worked
chrome_options = Options()   #here is the change
chrome_options.add_argument('--proxy-server=%s' % PROXY)
chrome = webdriver.Chrome(chromedriver, options=chrome_options)
chrome.get("https://whatismyipaddress.com")   #and here is the change, just https
Sign up to request clarification or add additional context in comments.

5 Comments

I put the changes, used many proxies including yours and it still won't connect ;/ , whats your chrome version??, anyways thanks for your help, I appreciate it!.
Try using different proxies from here sslproxies.org . My chrome version is 83. Did you even tried changing headers?
Try changing user agent as well. You can get free user agents from user-agents.net or you can use fake_headers module. "chrome_options.add_argument(f'user-agent={user-agent}')"something like this
I had v.81 chromedriver, maybe I was outdated idk. it worked but its super slow?, probably because of a free proxy.
Yeah,free proxies are mostly slow, you can use VPN as well

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.