How to do Website automation when NT Authentication Window Pop-up?
The objective of this article is to share automation tips how to handle NT authentication popup window. We will talk about –
- The testing scenario of NT Authentication
- Tips for the automation testing by Selenium
Scenario
There are several reasons that may result in automation testing failure. One of common scenario is the NT authentication. When we browse to the target internal website, that website required NT authentication for internal users to logon. In this situation, it will popout “Authentication Required”
Limitation of Selenium
If you are using Selenium as automation framework basis, it will be a challenge for selenium to handle this kind of popout. Since Selenium can only handle the Web related service elements, and the “Authentication Required” window is not parts of that website itself, how can we handle it?
Tips
Here are some approach
1. Firefox Add-on AutoAuth
https://addons.mozilla.org/en-US/firefox/addon/autoauth/
In this approach, it installs a FireFox add-on. Once you input the ID/PWD at the 1st time, the “Authentication Required” will be handled by the AutoAuth and login directly. In terms of automation, this approach is more stable and easy to achieve.
However, browser like Chrome or IE, which didn’t have the AutoAuth add-on, these will need to configure the Security Settings as workaround.
2. Configure of Security Settings
Control Panel > Internet Options or
Under IE Tools > Options > Security > Customize Level for local Intranet
Select “Automatic logon with current user name and password”
3. URL included credentials
Approach 1 and 2 are recommended. Though you can still submit the NT credentials in the URL as below, FireFox will still popout the authentication window.
Moreover, passing credentials through the URL is not very secure.
http://myusername:myuserpassword@mydomain.com/mypath/
4. AutoIT
This approach uses of AutoIT to detect the Window and click it. Then, compile the program as EXE for selenium to execute.
Summary
To handle NT authentication website, it may require authentication window pop-up. The recommendation is to use –
- For Firefox, uses of “AutoAuth” https://addons.mozilla.org/en-US/firefox/addon/autoauth/
- For IE/Chrome, configuration the security settings “IE Tools > Options > Security > Customize Level for local Intranet”