Automation of Login Functionality in Robot Framework

We can reduce the length of the code by creating a new resource file which includes the commonly used keywords of flight login functionalities. Let us find the unique element in the flight application page and write the test case for the same.

Open the ngendigital page and click on the Demo Application.


You can see a login form, right-click on the email and Inspect the element


Find the XPath for the email and password.


Xpath for Password


We have found the unique elements for email and password, Open the Ride editor and create a new test case as Flight Application.


Now, write the test case for the flight application


Now, select the test case and Run, once the test case starts executing, the ngendigital page will open and the email and password will be taken automatically and click on the login button and then closes the browser.

The Test Report is as shown below:


The Test case is having three steps that contain the email id, password and sign in we can enhance these files by creating a new Resource file.

Let us create a new resource file as Commonlyusedkeywords


And, creating a new User keyword as Log in to Flight application


Create new scalar variables ${username} and ${password} for commonlyusedkeywords by right-clicking on it and then open the Log in to Flight application and enter the keywords Input Text lines and then Click Element. instead of writing an actual username and password we can pass scalar variables as shown below.


We had created a user keyword that will be used in the flight application and hence we can use this user keyword just by importing the resource file in any of the test cases. In this way, we can reduce the length of the code. This process is known as keyword rewind functionality.

Now, add the Selenium library into the Commonlyusedkeywords, Open the commonlyusedkeywords and click on the Library under Import.


Enter the library name as SeleniumLibrary and click ok


Now, import the Resource file into the Web Automation suite


And also, we need to import Commonlyusedkeywords resource file into the Demo project, Open the Demo project and click on the Resource below Add Import.


Once the Resource dialog box will open, click on Browser


Go to your robot framework project folder and then open the Demo project folder, there you will find the Commonlyusedkeywords resource file, select and then click on Open button.


Once you import the resource file into the test case, the resource file will reflect inside the test suite, now open the test case and delete the input text and click element lines and insert a new keyword Log in to Flight applications.

The Enhanced functionality test case is as shown below:


Once you run the test case and you will get the same output as before.

Installation of Selenium Library

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions

Subscribe to See Videos

Subscribe to my Youtube channel for new videos : Subscribe Now