【问题标题】:How to run a Selenium NUnit test using Windows Authentication with Firefox?如何使用 Windows 身份验证和 Firefox 运行 Selenium NUnit 测试?
【发布时间】:2015-08-09 19:18:29
【问题描述】:

我们的网络应用需要 Windows 身份验证。我有一个 NUnit 测试

  1. 启动托管我的 Web 应用程序的 IIS Express 进程。
  2. 启动FirefoxDriver 并导航到网络应用程序。

不幸的是,它得到一个401.0 - Unauthorized 错误,甚至没有要求提供凭据。我习惯了 Firefox 要求提供凭据,在这种情况下您可以添加

        profile.SetPreference("network.ntlm.send-lm-response", true);
        profile.SetPreference("network.automatic-ntlm-auth.trusted-uris", "localhost");

但由于某种原因,我立即使用 登录用户 得到 401:匿名

如何告诉 Selenium/Firefox 使用集成安全性?查看 Windows 任务管理器,我看到 Firefox 进程以“我的身份”启动。

【问题讨论】:

    标签: firefox selenium selenium-webdriver windows-authentication iis-express


    【解决方案1】:

    呃。我编辑了错误的applicationhost.config。在 64 位操作系统上,相关的配置文件是 C:\Program Files\IIS Express\AppServer\applicationhost.config(不是 C:\Program Files (x86)\IIS Express\AppServer\applicationhost.config,不幸的是它也存在)。

    其中,我启用了 Windows 身份验证并禁用了匿名身份验证。然后 Firefox 开始询问凭据,然后我可以在传递给FirefoxDriver 的配置文件中设置network.automatic-ntlm-auth.trusted-uris,正如我的问题所述。

    【讨论】:

      猜你喜欢
      • 2020-12-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-12-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多