结合使用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).