且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用代理用户名和密码的Selenium WebDriver自动登录

更新时间:2023-12-03 19:28:58

尝试以下代码先设置代理,然后自动登录.

Try below code to set the proxy first and then autologin.

firefoxProfile.SetPreference("network.proxy.type", 1);
firefoxProfile.SetPreference("network.proxy.http", "add server name");
firefoxProfile.SetPreference("network.proxy.http_port", 8080);
firefoxProfile.SetPreference("network.proxy.ssl", "add server name");
firefoxProfile.SetPreference("network.proxy.ssl_port", 8080);
firefoxProfile.SetPreference("network.proxy.no_proxies_on", "add website url(s)");

Driver = new FirefoxDriver(firefoxProfile);

希望这对您有用.

谢谢, 安舒尔