Selenium 中的轮换代理 [英] Rotating proxies in Selenium

查看:30
本文介绍了Selenium 中的轮换代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在带有 Scrapy 的 Firefox 中使用 Selenium webdriver,现在我需要动态更改代理,但到目前为止我在文档中发现的是,当我实例化 webdriver 本身时,我可以在配置文件中指定代理.所以这意味着我不能动态更改代理?

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?

推荐答案

selenium 不提供这种功能.一旦启动浏览器,就无法动态更改浏览器首选项/所需功能.

您必须关闭/退出浏览器并使用新的代理配置启动另一个 webdriver 实例.

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

另见相关讨论:

这篇关于Selenium 中的轮换代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆