Handle Authentication Popup using Selenium Webdriver
Hello, people welcome back to Selenium Tutorial, in this post we will see how to handle windows authentication popup using Selenium webdriver.
Why we are getting Authentication window
Each company having some proxy setting for the specific application so while running script using Selenium you will get this authentication window which asks for Username and password so until we don’t handle this you cannot navigate to parent window.
Example- I have found this URL where actually u can see this pop-up.
How to Handle Authentication using Selenium
I think its time to handle this Authentication so now there are two ways for this.
Refer complete video for the same-
First approach- Handle Windows Authentication popup using Selenium Webdriver
You can provide credentials in URL itself it means we will add username and password in URL so while running script it will bypass the same.
Second approach: Handle Windows Authentication popup using Selenium Webdriver
We can use AutoIT again to handle this authentication window for this Please check whether you have AutoIT installed or not. If not then please download from here
1) Open the Url ENGPROD on which the authentication is required and open the AutoIt Window Info tool to get the name of the class and the text of the authentication window.
2) drag the ‘Finder Toolbox to the object in which you are interested and it displays you the information.
3) If you download the full version of Scite4AutoIt3 and look for the Au3Recorder in the Tools menu.
Open the Script Editor window, save the blank file with ‘.au3′ extension and then go to Tools > AU3Recorder or Alt + F6 on AutoIt Script Editor.
A window will open for recording. Let us record the steps to send the username & password to the authentication window, for that please activate the Recorder by Tools >AU3Recorder or Alt + F6 on AutoIt Script Editor.
5) Once you did with your recording, your code will look like this.
The next step is to convert it into the .exe format. For that, you need to do a right click on the .au3 file and select “Compile Script“.
Note: Make sure that you select ‘Compile Script’ as per your machine configuration. Select normal version if you are on 32 bits, and select x64 or x86 if you are on 64 bits.
7) Once you did with the compiling, it will create the ‘.exe’ file with the same name under the same folder and that ‘.exe’ the file will be called in the Selenium Test Script by using the following script: