下面代码使用selenium代理ip打开百度为什么打开这么慢甚至打不开,每一个有用的ip都是这样,是selenium代理本身有问题吗。
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
# # 声明一个谷歌插件,不加载图片#不加载图片节省时间
driver_path = r'C:\Users\Administrator\AppData\Local\Google\Chrome\Application\chromedriver.exe'
options = webdriver.ChromeOptions()
options.add_experimental_option('prefs', {'profile.managed_default_content_settings.images': 2})
options.add_experimental_option("excludeSwitches", ["enable-logging"])
# 无可视化
chrome_options = Options()
# chrome_options.add_argument("--headless")
chrome_options.add_argument("--disable-gpu")
chrome_options.add_argument('--ignore-certificate-errors')
chrome_options.add_argument('--proxy-server=http://103.233.154.242:8080')
# 规避检测
option = webdriver.ChromeOptions()
option.add_experimental_option('excludeSwitches', ['enable-automation'])
url = 'http://www.baidu.com'
driver = webdriver.Chrome(executable_path=driver_path,chrome_options=chrome_options, options=options)
driver.get(url)