0

I've bound port 3003 on my local machine to a remote server

ssh user@remoteserver -D 3003

And in my python script

from selenium import webdriver

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--proxy-server=http://127.0.0.1:3003")
driver = webdriver.Chrome(chrome_options=chrome_options)
driver.get('http://google.com')

When I run the script, I get no error, chrome launches and I fail to load google.com. Shouldn't this script be making requests through 127.0.0.1:3003?

The ssh tunnel is good. If I manually set a proxy in my browser to 127.0.0.1:3003, requests go through my remote server. Where am I going wrong in this script?

rocketas
  • 1,569
  • 3
  • 16
  • 29

1 Answers1

1

per @Shawn Spitz's comment on Setting a proxy for Chrome Driver in Selenium one needs to use socks5// for this because its a socks proxy. I had http, so chrome_options.add_argument("--proxy-server=socks5://127.0.0.1:3003")

Community
  • 1
  • 1
rocketas
  • 1,569
  • 3
  • 16
  • 29