One of my applications had Http authentication for security purpose and I had need to automate using webdriver. As we know http authentication is not a part of DOM object so we cannot handle it using webdriver. Here is approach to handle such type situation.
We need to pass http credential with URL to skip http popup authentication window. Below is URL format.
After using above approach, http authentication popup window disappear. But in Internet explorer, it raise error with message “wrong format url”. To accept same type url in internet explorer browser we need to add a DWORD value named exploere.exe and iexplore.exe with value data 0 in below registry.
To open registry, open "regeidt" from run command.
We need to pass http credential with URL to skip http popup authentication window. Below is URL format.
User above formatted URL in webdriver
get method:
driver.get(“http://username:passwork@applicationURL”)
After using above approach, http authentication popup window disappear. But in Internet explorer, it raise error with message “wrong format url”. To accept same type url in internet explorer browser we need to add a DWORD value named exploere.exe and iexplore.exe with value data 0 in below registry.
To open registry, open "regeidt" from run command.
- For all users of the program, set the value in the following registry key: HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_HTTP_USERNAME_PASSWORD_DISABLE
- For the current user of the program only, set the value in the following registry key: HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_HTTP_USERNAME_PASSWORD_DISABLE
- If you are using 64 bit machine, set the value in the following registry key. HKEY_CURRENT_USER\Software\WOW6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_HTTP_USERNAME_PASSWORD_DISABLE