Selenium Web Driver support only web application testing.So, window's popup can not be handled using Selenium.
Here I will use AutoIt scripting tool to automate the Window's Authentication Popup.
Follow the Steps mentioned as below:
Here I will use AutoIt scripting tool to automate the Window's Authentication Popup.
Follow the Steps mentioned as below:
- Download and Install AutoIt Scripting tool
- Open text Editor (SciTE Script editor)
3. Write the Code in the Text Editor as bellow:
4. Now, convert the .au3 file in executable using Compile Script to .exe tool. The Script is ready to use with the selense command.
AutoItSetOption("WinTitleMatchMode","2") WinWait("Authentication Required") $title = WinGetTitle("Authentication Required") ; retrives whole window title $UN=WinGetText($title,"User Name:") ControlSend($title,"",$UN,"Username");Sets Username Sleep(2000); $PWD=WinGetText($title,"Password:") Send("{TAB 1}") Sleep(2000); ControlSend($title,"",$PWD,"password");Sets PWD Send("{ENTER}")The Script will be saved with .au3 extension.
4. Now, convert the .au3 file in executable using Compile Script to .exe tool. The Script is ready to use with the selense command.
Place the authentication Script(autoit script ) under the Project folder and set the path in Object.Property File(How to set all the locators in the Object Property file).
Initialize the New Process using below Code:
static Process p = null; p=Runtime.getRuntime().exec(c.getElementName("Auth_path")); p.destroy();
Where "auth_path" is the element name defined in the Object repository file and destroy the process at the end of the program execution.
No comments:
Post a Comment