98 Views
4 minutes read
Categories
Selenium

Automate Windows Authentication Popup in Selenium using Sikuli

Introduction

Selenium can interact with the web application only. It cannot automate windows or flash-based objects. In situations where a window authentication pops up, Selenium is unable to handle it. A third-party tool like AutoIt, Sikuli comes to rescue here.

This blog targets automating Windows authentication popup using Sikuli.

When to use Sikuli?

Sikuli is an open-source tool for test automation. Using image recognition technique Sikuli identifies the control GUI components.

It can automate anything which is visible on the screen and is useful when there is no easy access to the GUI’s internal or source code.

Advantages of Sikuli

  • Selenium web driver only supports web-based objects but using Sikuli, both windows and web-based objects can be managed
  • Selenium web driver cannot support flash objects but using Sikuli we can handle flash objects
  • Sikuli can be run on any platform Windows, Mac, Linux
  • Sikuli can automate any test which is running on remote servers
  • In some cases, if proper web elements are not available, then we can use Sikuli to identify the web elements from the screen
  • Sikuli can be integrated with any other tool like Selenium, Cucumber

How to integrate Sikuli with Selenium?

We can integrate Sikuli with selenium in two different ways, which are detailed below:

Adding Sikuli jar file directly to the eclipse IDE
Automate Windows authentication popup in Selenium using Sikuli
Adding sikuli maven dependecny in POM.xml file
Automate Windows authentication popup in Selenium using Sikuli
  • Use the maven dependency in the project POM.xml file and build the project
How to automate the Windows Authentication popup using Sikuli?
  • Open the url
  • Take the screen shot of Username and store it in a local drive
  • Take the screen shot of Password and store it in a local drive
  • Take the screen shot of Sign in button and store it in a local drive
Automate Windows authentication popup in Selenium using Sikuli
  • Add the below code snippet for automating the Windows authentication pop up
Automate Windows authentication popup in Selenium using Sikuli

Details of the code snippet

  • First need is to create an object of screen class. The screen class will allow access to all the methods used by sikuli.
  • Create an object of the pattern class. The pattern will allow the user to pass the reference of an image on which they want to perform the operation like click, double click, type etc.

When the program is executed, Selenium searches the images which were passed as a reference in the pattern object. After that, the methods available in the screen class for typing and clicking are used.

For operation like typing values in the username field, a pattern object is created for the username field and passed the reference of an image file (uname.png) to the pattern object. After that, using the method of screen class for typing the value in the username field, the action (type, click) will perform if the file exists.The same thing wil happen to typing the value in the Password field and clicking on SignIn button

Conclusion

Sikuli is a powerful tool and it works on any GUI. It can work on any platform (Windows/Linux/Mac) and can interact with virtual machines, remote desktop, and mobile simulators like Android and iPhone. Apart from automating windows based and flash-based application, Sikuli can be helpful in automating mobile testing using Android and iPhone emnulators. Sikuli sees a vast scope in use. It can be used to extract text from an image using its basic text recognition using OCR. While Selenium cannot automate CAPTCHA, using Sikuli we can automate the CAPTCHA in Selenium.

Aniruddha Mridha

About Aniruddha Mridha

Anirudha has13+ years of experience in software testing(Manual and Automation testing). Having ideas of different software testing methodologies like Waterfall, V-Model, and Agile, etc. Experience in handling both manual and automation projects. He also experienced in automation and API testing.

He was working on different automation tools like Selenium, Protractor, Karate, and QTP.Experience in automation framework development(Hybrid and Keyword Driven framework).

He has good knowledge in handling ERP project(Knowledge of different modules of ERP MM, Finance, and SD)

LinkedinTwitterFacebook

Leave a Reply

Your email address will not be published. Required fields are marked *




Enter Captcha Here :