Using Selenium Webdriver with Windows Authentication (in Chrome) C#/ASP.Net

ⅰ亾dé卋堺 提交于 2019-12-08 01:59:46

问题


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

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.

This is what I have.

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

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!


回答1:


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).



来源:https://stackoverflow.com/questions/45021886/using-selenium-webdriver-with-windows-authentication-in-chrome-c-asp-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!