2

I am a newbie in using selenium. When I use proxy chrome shows there is no internet connection. I have checked my internet connection and looked for possible solutions on the internet but failed. I also restarted my computer but it did not work.

    from selenium import webdriver
    from selenium.webdriver.chrome.options import Options
    from time import sleep

    PROXY = '43.225.164.59:38829'


    options = Options()
    options.add_argument('--proxy-server=%s' % PROXY)
    driver = webdriver.Chrome(options = options,         
                              executable_path='C:\webscraping\chromedriver')
    driver.get('https://whatismyipaddress.com/')

    sleep(6)

    driver.close()
Masroor
  • 61
  • 6

1 Answers1

0

The code is looking good, it should works.

Do you use proxy with authentification? If do, you should use another way to enable proxy - issue (Selenium doesn't support authentification of proxy).

You should also be sure, that proxy is working. Check it with curl:

If you're using public proxy:

curl https://2ip.ru/ -x "http://proxy_host:proxy_port" 

If you're using private proxy with authentification:

curl https://2ip.ru/ -x "http://proxy_user:proxy_pwd@proxy_host:proxy_port" 

Both of these commands will return your ip address (it should be equal to proxy address you use.