【问题标题】:How to bypass authentication in selenium如何绕过硒中的身份验证
【发布时间】:2011-07-20 00:30:54
【问题描述】:

我正在尝试自动化一个安全应用程序(使用 useragent - iphone),该应用程序在我打开网站时要求进行身份验证。我尝试在 URL 本身中提供凭据以绕过身份验证,但它会弹出一个对话框进行确认,我无法通过代码处理它。

FirefoxProfile profile = new FirefoxProfile();     
profile.setPreference("general.useragent.override",
    "Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420.1"
    + "(KHTML, like Gecko) Version/3.0 Mobile/3B48b Safari/419.3)"); 
WebDriver driver = new FirefoxDriver(profile); 
String site = "http://akamai:ecnt0k3n@ecn13-secure-store.nike.com";
driver.get(site);

非常感谢您对此的任何帮助。

谢谢, 修行

【问题讨论】:

  • 通过身份验证你说的是“代理身份验证”

标签: authentication selenium webdriver


【解决方案1】:

Mozilla 阻止钓鱼尝试。你检查Network.http.phishy-userpass-length了吗?

顺便说一句,根据Selenium's issue 34#8,这应该可以:

FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("network.http.phishy-userpass-length", 255);
driver = new FirefoxDriver(profile);
driver.get("http://username:password@www.basicauthprotected.com/");

注意:这个问题和BASIC Authentication in Selenium 2 - set up for FirefoxDriver, ChromeDriver and IEdriver差不多。

【讨论】:

    【解决方案2】:

    您可以使用 Selenium 的新 WebDriver 将信息输入到该类型的对话框中。但是我没有这样做。

    【讨论】:

      猜你喜欢
      • 2014-12-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-19
      • 1970-01-01
      • 1970-01-01
      • 2018-09-28
      相关资源
      最近更新 更多