我用selenium将website.due中的数据从IP上丢弃到大量的流量中,现在我无法访问网站(可能是我的ip被屏蔽了)。
是否有任何方法来设置代理IP,以便每次我运行WebDriver.webdrip时都将其作为一个新的IP对待?
发布于 2015-10-15 08:11:40
您可以按照以下方式使用selenium设置代理IP:
FirefoxProfile profile = new FirefoxProfile();
profile.addAdditionalPreference("network.proxy.http", "localhost");
profile.addAdditionalPreference("network.proxy.http_port", "8080");
WebDriver driver = new FirefoxDriver(profile);您应该在上面的代码中更改您想要的IP地址和端口。
有关更多细节,请查看:带代理的Selenium with驱动程序
https://stackoverflow.com/questions/33142340
复制相似问题