2

whenever I try to use a proxy with undetedted-chromedriver, it just doesn't work and diplays my ip. When I use the normal webdriver, it works perfectly.

from selenium import webdriver
from time import sleep


ip_port = "ip:port"

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--proxy-server=%s' % ip_port)
driver = uc.Chrome(use_subprocess=True, chrome_options=chrome_options)

driver.get('https://www.myexternalip.com/raw')
sleep(999)

How can I make the proxy work with undetected chromedriver?

This is the site https://www.myexternalip.com/raw : With undetected chromedriver (gives my actual ip)

ip adress

Thanks for your help.

xtekky
  • 572
  • 1
  • 4
  • 13
  • Check out the answer from the other thread [here](https://stackoverflow.com/questions/55582136/how-to-set-proxy-with-authentication-in-selenium-chromedriver-python#answer-55582859) – anonymous Apr 03 '22 at 18:18
  • @NaphatTheerawat its not about authentication, its about making the proxy work with undetected-chromedriver – xtekky Apr 03 '22 at 22:51

3 Answers3

1

I assume you set up a green flag for your machine on your server, so you don't need to enter the login and password for the server:

options.add_argument('--proxy-server=185.195.81.152:12573') 
options.add_argument('--proxy-server=socks5://185.195.81.152:12573') # socks5
options.add_argument('--proxy-server=https://185.195.81.152:12573') # https

also suggest using:

options.add_argument('--proxy-bypass-list=<-loopback>')

If you didn't green flag your machines IP to the server, then you'll need to provide the login and password as well:

options.add_argument('--proxy-server=proxy_username:proxy_password@proxy_ip:proxy_port')
kit4py
  • 48
  • 8
0

Got it work with:

chrome_options = Options()
chrome_options.add_argument('--proxy-server=ip:port')
driver = uc.Chrome(options=chrome_options)
driver.get('https://www.myexternalip.com/raw')
kaliiiiiiiii
  • 925
  • 1
  • 2
  • 21
xtekky
  • 572
  • 1
  • 4
  • 13
-1

You can use a chrome extension to change your IP using a proxy. For example I use SwitchyOmega. Then I set the proxy inside the extension and it works completely fine.