Nic*_*ahn 11 selenium webdriver selenium-webdriver
弹出窗口只发生在我使用Fire Fox浏览器的情况下,有没有办法解决这个问题?每次我使用FF作为我的浏览器时,我必须输入用户名/密码.
目前,我每次运行我的测试都会进入,这非常痛苦,但希望使其更加自动化....

如果这是Windows用户帐户和密码,则需要通过设置启用集成Windows登录
network.negotiate-auth.delegation-uris: MyIISServer.domain.com
network.automatic-ntlm-auth.trusted-uris: MyIISServer.domain.com
network.automatic-ntlm-auth.allow-proxies: True
network.negotiate-auth.allow-proxies: True
Run Code Online (Sandbox Code Playgroud)
在WebDriver启动的Firefox配置文件中.创建并保存配置文件后(在没有其他实例运行时运行"Firefox -P"以选择配置文件),您可以在代码中执行此操作:
File profileDir = new File("C:/wherever/SeleniumFirefoxProfile");
FirefoxProfile profile = new FirefoxProfile(profileDir);
profile.setEnableNativeEvents(true);
driver = new FirefoxDriver(profile);
Run Code Online (Sandbox Code Playgroud)
花了几个小时阅读后,我终于找到了解决方案,效果很好,我希望这也能帮助别人.- 请享用!!
首先 - 按照以下步骤操作:
1) Open the FireFox browser
2) Type the following `about:config`
3) Look for `network.http.phishy-userpass-length` if you don't find then create a new Integer key
Create a new Integer key (right-click->New->Integer): `network.http.phishy-userpass-length` with value `255`
Run Code Online (Sandbox Code Playgroud)
第二:您需要使用以下内容创建Firefox驱动程序:
FirefoxProfile profile = new FirefoxProfile();
profile.SetPreference("network.http.phishy-userpass-length", 255);
profile.SetPreference("network.automatic-ntlm-auth.trusted-uris", "YOUR HOST ADDRESS HERE");
_driver = new FirefoxDriver(profile);
Run Code Online (Sandbox Code Playgroud)
如果您有任何疑问,请与我联系.
| 归档时间: |
|
| 查看次数: |
21372 次 |
| 最近记录: |