简体   繁体   English

如何在Selenium Webdriver Java中设置多个代理

[英]How to set multiple proxies in Selenium Webdriver Java

My requirement is for opening my project site it requires two different proxies. 我的要求是打开我的项目网站,它需要两个不同的代理。 How to handle it with Selenium Webdriver? 如何使用Selenium Webdriver处理它?

Please help me. 请帮我。

You haven't mentioned what driver you are using(Firefox, Chrome, ..)but this is how you do it for Firefox: 你还没有提到你正在使用的驱动程序(Firefox,Chrome,..),但这是你为Firefox做的:

        FirefoxProfile profile = new FirefoxProfile();
        profile.setEnableNativeEvents(true);

        profile.setPreference("network.proxy.http_port", proxyPort);
        profile.setPreference("network.proxy.ssl", proxyHost);
        profile.setPreference("network.proxy.ssl_port", proxyPort);

        FirefoxDriver driver = new FirefoxDriver(profile);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM