selenium加代理ip

from selenium import webdriver #导入webdriver

#加入代理ip
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--proxy-server=http://’+ip:端口)


driver = webdriver.Chrome(chrome_options=chrome_options)#模拟浏览器加入ip,这里我使用的是谷歌浏览器

url=网址  #需要爬取的网址
driver.get(url)

这样就selenium 的代理加完成了
 
  
如果还想了解selenium其他东西,点击打开链接

你可能感兴趣的:(selenium,selenium)