Selenium Python Running A Browser With A Proxy
I am trying to write a very simple script that takes a proxy (that does not need authentication) from a txt file and opens a browser with it, and then loops this action for a certa
Solution 1:
Try below solution:
from selenium import webdriver
PROXY = "96.70.52.227:48324"# HOST:PORT
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--proxy-server=%s' % PROXY)
chrome_options.add_argument("ignore-certificate-errors")
chrome = webdriver.Chrome(options=chrome_options)
chrome.get("https://www.ipchicken.com/")
Solution 2:
Why not just pass the proxy as a CL argument?
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument("--proxy-server=127.0.0.1:9021")
driver = webdriver.Chrome(options=options)
Post a Comment for "Selenium Python Running A Browser With A Proxy"