Handling Windows authentication with Selenium Webdriver

大兔子大兔子 提交于 2019-12-03 16:34:18

You can NOT auth through this window with Selenium. Because of this is not browser window, but OS's authentication popup. Selenium have no ability to work with other processes except browsers.

But you can auth WITHOUT getting this window.

There is 2 ways to miss it:

  1. Change URL with authentication to: http://user:password@www.yourserveradress.com . This will work in part of situations and will authenticate you to needed service. In another case you can use way 2. [too old way, doesnt work now]

  2. You need to create a new profile in browser, pass authentication to needed service and remember password/authentication. And, ofc, use created browser profile in your tests.

    2.1. In case of service have short cookies life time, you can use "AutoAuth" plugin for your browser additionally in your profile from step 2.

upd: as I know there is some new way for selenium 3.0, you need to search more. This is too old answer. please ping me if you will wind better way.


  1. You can write own realization of login through the login popup with "White" framework. On needed step you can check all shown OS's windows for "correct" title. And in case of such title exist, get window's handle. And to do login using "White".

When passing credentials through url is not working, you can do this by is using an external software "AutoIt V3" This works well with the windows authentication.

In the end I used a workaround, navigating first to the authentication page, authenticating and then redirecting to the page to be tested as an authenticated user. This approach uses pages internal authentication page which can be scripted to.

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