python selenium Chrome Web Driver. How to Proxy IP/ Where to buy

主宰稳场 提交于 2019-12-12 02:24:43

问题


So i want to make Selenium Project where I need to change my ip to to a specific Cities.For example one in Dallas, One in NewYork, One in Los Angles.

I wanted to know how do I apply a proxy to the chrome web driver using PYTHON. If you guys can show me an example code that would be very helpful. I have seen others with Firefox web driver but not the chrome web Driver.

Also where can i buy a Dedicated IP PROXY for each city. I want to be the only one using that ip Address.


回答1:


from selenium import webdriver

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--proxy-server=1.2.3.4:8080')
driver = webdriver.Chrome(chrome_options=chrome_options)

driver.get("...")


来源:https://stackoverflow.com/questions/41785088/python-selenium-chrome-web-driver-how-to-proxy-ip-where-to-buy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!