chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("user-agent=Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36")
driver = webdriver.Chrome(chrome_options=chrome_options)
# 复制一份内置的配置文件
desired_capabilities = webdriver.DesiredCapabilities.INTERNETEXPLORER.copy()
# 改变配置文件的代理.
desired_capabilities['proxy'] = {
"httpProxy": 代理ip,
"ftpProxy": 代理ip,
"sslProxy": 代理ip,
"noProxy": None,
"proxyType": "MANUAL",
"class": "org.openqa.selenium.Proxy",
"autodetect": False
}
driver = webdriver.Chrome(desired_capabilities=desired_capabilities)
driver = webdriver.Chrome()
driver.delete_all_cookies()
driver.add_cookie(cookie)
driver = webdriver.Chrome()
driver.delete_all_cookies()
for cookie in cookies:
driver.add_cookie(cookie)