CodedUI-Chrome浏览器中的Windows身份验证 [英] CodedUI - Windows Authentication in Chrome Browser

查看:108
本文介绍了CodedUI-Chrome浏览器中的Windows身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用跨浏览器硒组件插件在Chrome浏览器中运行codedui测试。当我启动Web应用程序时,它需要Windows身份验证才能登录到网站。

I'm using "Cross Browser Selenium Components" plugin to run codedui tests in Chrome browser. When i launch my web application, it needs windows authentication to log in to the website.

如何在编码的UI中传递用户名和密码以及URL?

How do i pass the username and password along with the URL in coded UI?

Webdriver等效代码是:

Webdriver equivalent code is:

baseUrl = http:// +用户名+: +密码+ @ +网址;

baseUrl="http://" + username + ":" + password + "@" + url;

driver.get(baseUrl + /);

driver.get(baseUrl + "/");

但是在codedui中,当我执行以下代码时,会弹出身份验证窗口,但控件不会过去 browser.NavigateToURL ,因此我无法提供用户名和密码。

But in codedui, when i execute the below code, authentication window pops up but the control does not get past browser.NavigateToURL and hence i cannot provide username and password.

        BrowserWindow.CurrentBrowser = "chrome"; 
        string URL = "http://servername:portnumber/index.jsp";             
        BrowserWindow browser = BrowserWindow.Launch();
        browser.NavigateToUrl(new Uri(URL));

请提供任何帮助。

Any help would be highly appreciated please.

推荐答案

上面给出的答案没有错,但是在您的代码(或ini或配置文件)中包含密码可能不是最好的方法。

Answers given above are not wrong but including passwords in your code(or ini or config file for that matter) might not be the best way to go.

总是隐藏或加密密码。

您可以通过 网址。

You can go through this url on how to do that.

这篇关于CodedUI-Chrome浏览器中的Windows身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆