Rotating proxies in Selenium

大城市里の小女人 提交于 2020-01-01 15:23:48

问题


I use Selenium webdriver for Firefox with Scrapy and now I need to change proxies dynamically but all I've found so far in docs is that I can specify proxy in profile when I instantiate webdriver itself. So it means that I can't change proxy in dynamically?

Is there any way to do that?


回答1:


selenium does not provide this kind of functionality. It is not possible to dynamically change the browser preferences/desired capabilities once you've launched the browser.

You have to close/quit the browser and start up another webdriver instance with a new proxy configuration.

See also relevant discussion:

  • Modify preferences of RUNNING Firefox instance via WebDriver


来源:https://stackoverflow.com/questions/29450802/rotating-proxies-in-selenium

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