Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rotating proxies in Selenium

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?

like image 221
Dmitrii Mikhailov Avatar asked Sep 28 '22 09:09

Dmitrii Mikhailov


1 Answers

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
like image 179
alecxe Avatar answered Oct 24 '22 03:10

alecxe