问题
Hi I am fairly new to selenium and I am building a bot that visits a website and enters a term then submits. The issue is that you can only Submit a certain amount of times before the IP address used gets blocked by the server for spam. Is there a way I can implement a proxy rotation every time it opens up a new chrome browser.
回答1:
It would be important to know which browser you are using because the settings differ a bit from browser to browser.
Here is an example of how to use a proxy with Chrome:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
PROXY = "1.111.111.1:8080" #your proxy
chrome_options = WebDriverWait.ChromeOptions()
chrome_options.add_argument('--proxy-server=%s' % PROXY)
chrome = webdriver.Chrome(chrome_options=chrome_options)
chrome.get("yourwebsite.com")
来源:https://stackoverflow.com/questions/62237063/proxies-selenium