seb*_*eli 39 java selenium cross-browser basic-authentication selenium-webdriver
我正在使用Selenium-Firefox驱动程序和Selenium-Chrome-Driver版本2.0a5(Web驱动程序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");
Run Code Online (Sandbox Code Playgroud)
但它似乎对我不起作用.有没有人为这些浏览器提供有效的解决方案?
Rod*_*Rod 10
我通过以下方式使用Firefox webdriver:
profile.SetPreference("network.automatic-ntlm-auth.trusted-uris", "google.com");
driver = new FirefoxDriver(profile);
driver.Navigate().GoToUrl("http://user:pwd@google.com");
Run Code Online (Sandbox Code Playgroud)
是的,目前不支持BASIC HTTP身份验证,但我现在正在为FF和Chrome工作.
我在问题中写的代码适用于那些驱动程序.我只是尝试使用FF3.6作为Firefox默认浏览器(安装在Firefox文件夹中)而不是FF4(尚不支持).对于IE,我可能会尝试通过Windows注册表禁用身份验证.
此页面http://code.google.com/p/selenium/issues/detail?id=34可能有所帮助.
归档时间: |
|
查看次数: |
58326 次 |
最近记录: |