结合使用Selenium Webdriver和Windows身份验证(在Chrome中)C#/ASP.Net [英] Using Selenium Webdriver with Windows Authentication (in Chrome) C#/ASP.Net

查看:157
本文介绍了结合使用Selenium Webdriver和Windows身份验证(在Chrome中)C#/ASP.Net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Google放弃了通过URL传递Windows凭据的支持,这给我带来了很多自动化. (用户名:password@www.url.com)

Google dropped support for passing windows credentials via URL and it broke a lot of automation for me. (username:password@www.url.com)

https://www.chromestatus.com/feature/5669008342777856

我发现有一种添加了AutoItX dll的解决方案,并且在本地运行时效果很好,但是当部署到Web服务器时,它不会发送按键.

I found there is a solution using AutoItX dll which I added and it works fine when running locally, but when deployed to web server it does not send key strokes.

这就是我所拥有的.

AutoItX.WinWaitActive(authenticateurl + " - Google Chrome", "", 10);
AutoItX.WinActivate(authenticateurl + " - Google Chrome");
AutoItX.Send(AdminUsername + "{TAB}");
AutoItX.Send(AdminUserpass + "{ENTER}");

有人知道为什么AutoItX部署后不起作用吗?有没有更好的选择可以在Chrome浏览器中传递Windows凭据?预先谢谢你!

Any idea why AutoItX would not work when deployed? Is there a better alternative to pass windows credentials in the Chrome Browser? Thank you in Advance!

推荐答案

我猜这是因为该代码将在服务器上的低特权用户帐户下运行(很有可能是本地系统帐户,而不是域帐户).

I'd guess that this is because that code will be running under a low privilege user account on the server (more than likely a local system account rather than a domain account).

您将需要交换运行应用程序池的帐户(请注意,如果所讨论的服务器上存在任何机密信息),或者调试为什么不允许当前帐户访问.

You'll either need to swap the account that the app pool runs as (be careful if there is anything vaguely confidential on the server in question) - or debug why the current account isnt allowed access.

在第二种情况下,您可以尝试登录到计算机,以该系统帐户运行浏览器,然后查看事件日志以查看尝试手动登录时生成的日志(也可以在运行时执行此操作)如果您没有该帐户的凭据,则可以进行自动化操作.)

In the second case, you could try logging onto the machine, running a browser as that system account and then watching the Event Log to see what logs are generated when you try to log on manually (you could also do this while running your automation if you dont have that account's credentials).

这篇关于结合使用Selenium Webdriver和Windows身份验证(在Chrome中)C#/ASP.Net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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