Robot Framework with Selenium and Python

Robot Framework with Selenium and Python


Introduction of Robot Framework

The robot framework could be a generic check automation framework for acceptance testing. It utilizes the keyword-driven testing approach. Robot framework provides smart support for external libraries, and tools that area unit open supply and might be used with mechanism framework. It has a simple syntax, utilizing human-readable keywords. Its capabilities may be extended by libraries enforced with Python, Java, or several different programming languages.

Robot Framework Architecture

The robot framework features an extremely standard design as seen in the figure below. it’s a technology-independent framework that uses keyword-driven testing

Robot Framework Architecture

  • Test Data:

The initial layer of the Robot structure, test data, is presented in tabular form. The tabular format of the data makes data maintenance relatively simple. This test data serves as the input to the Robot framework, which begins processing it after receiving it and then executes it while producing reports and logs. The Report is available in XML and HTML formats.

  • Robot Framework

The primary advantage of the automaton framework is that it’s agnostic of the target below take a look at. The interaction with the layers below the framework may be done by exploiting the libraries [built-in or user-created] that build use of application interfaces.

  • Test Libraries & Test Tools

The Robot framework only interacts with the other layers of the system via libraries, the code is portable and manageable. Typically, libraries are imported at the beginning of the implementation.

Test Libraries & Test Tools

  • System Under Test

This is   target on which the testing activity is performed. It might either be a website or an internet app. Libraries act as an interface between the automaton Framework and also check the system under test

System Under Test

Keyword-Driven Testing (Table-Driven Testing)

An approach to testing known as “keyword-driven testing” involves creating data tables containing pertinent keywords that are independent of the testing framework.

Types Of Keywords:

Robot Framework offers two categories of keywords:

  • Library Keywords: Low-level keywords for libraries are another name for these keywords. The libraries used with the Robot Framework provide access to these (Built-in and External libraries)
  • User-Defined Keywords: High-level keywords are another name for user-defined keywords. The user establishes them. Other Library keywords might also be included in user-defined keywords.


Step1: Install Python on windows

Click Python Download

Verifying: Navigate to directory


The following pop-up window will be appeared.


Step 2: Configure Environment Variables And To check if python and pip are correctly installed:

  • Python: python –version
  • PIP: pip –version

Step 3: Install PyCharm IDE

To download PyCharm to visit the website and click download link under community section

Step 4: Install Selenium

pip install selenium

Step 5: Install Robot Framework

pip install robot framework

Step 6: Install Robot Framework-Selenium Library

pip install robot framework-selenium library

Step 7: In PyCharm IDE we need to install selenium, robot framework and Robot Framework-selenium Library packages

  • Go to PyCharm->select Project->Select file->open settings ->Click Python Interpreter->click on (+) icon->search Library which you want->click installed

Test Scripts

Robot Framework takes a look at scripts text files with (. robot) extension. The four sections of the basic mechanism take a look at scripts are settings, variables, keywords, and Test cases.

Settings: Settings section contains the import statements for the external libraries, resources, and the setup and teardown commands.

Variables: Variables section contains keyword arguments, global, and native values. Variables create it simple to alter the check information in one location.

Keywords: The keywords section contains operations accustomed to executing the tests. The various varieties of keywords are built-in keywords, library keywords, and user-defined keywords

Test Cases: Test cases in robot framework are allowed to write in simple English language.

Creating First Test Case in Robot Framework

Go to file->click on new project->ProjectName->addPackages like Selenium,RobotFramework->RobotFramework-Selenium->Create robot testecase file(filename.robot)

ScenarioOpen the browser as I have created the variables to hold the values like ${browser} and ${URL}, click on the login link , enter Email address and password and close browser

Creating First Test Case in Robot Framework

  • Execute the code using the command robot from the terminal.

Execute the code using the command robot from the terminal

Report file

Report files include an HTML-formatted summary of the test execution outcomes. In addition to a list of all performed test cases, they also have statistics based on tagged and executed test suites. The report contains links to the log file for convenient browsing to more extensive information when both reports and logs are created. The report makes it simple to see the overall state of test execution.

Report file

Log file

Log files include HTML-formatted information about the test cases that were actually run. They display information about the test suite, test case, and keyword in a hierarchical manner. To thoroughly analyse test findings, log files are almost always required. Although log files also contain statistics, reports are preferable for getting a higher-level overview.

 Log file


1. It is very easy to install and helps in creating and executing test cases. Any newcomer can easily understand.

2. It supports Keyword-driven, behaviour testing and data-driven style of writing test cases


1. Robot framework does not support parallel test execution

2. Robot Framework has strict indentation rules.


The Robot framework is an easy-to-understand open-source tool which provides a modular interface to build custom automation test cases. Large organisations have adopted it for this reason, and with good reason. As demonstrated above, it is useful for automation testers.

Got a query? Let’s connect to our testing experts or write to [email protected]!