我正在使用Selenium-Firefox 驱动程序 and Selenium-Chrome-驱动程序版本 2.0a5 (网络驱动程序API),我正在尝试测试一个具有 BASIC 身份验证的 Web 应用程序(当我点击任何页面时,都会出现一个弹出窗口来对用户进行身份验证,该弹出窗口不是 HTML 的一部分)。
现在,我需要一个策略来在 Firefox、Chrome 和 IE 中对用户进行身份验证(我将很快导入 IE 驱动程序)。
我在几篇文章中读到我可以设置 Firefox 配置文件,例如:
FirefoxProfile ffProfile = new FirefoxProfile();
ffProfile.setPreference("network.http.phishy-userpass-length", 255);
WebDriver driver = new FirefoxDriver(ffProfile);
driver.get("http://username:password@hostname");
但这似乎对我不起作用。有人有适用于这些浏览器的可行解决方案吗?
我通过以下方式让它与 Firefox webdriver 一起工作:
profile.SetPreference("network.automatic-ntlm-auth.trusted-uris", "google.com");
driver = new FirefoxDriver(profile);
driver.Navigate().GoToUrl("http://user:[email protected]");
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)