Robot Selenium Python
- Home
- Robot Selenium Python
Using Robot Framework with Selenium in Python is a popular choice for writing readable, keyword-driven automated browser tests. Here’s a quick overview to help you get started:
What Is Robot Framework?
A generic open-source automation framework.
Used for acceptance testing and RPA (Robotic Process Automation).
Uses a keyword-driven approach for writing test cases.
What Is SeleniumLibrary?
It’s a web testing library for Robot Framework.
Wraps the functionality of Selenium WebDriver.
Installation
To get started, you can install the necessary packages with pip
:
pip install robotframework
pip install robotframework-seleniumlibrary
Example: Simple Login Test
Folder structure:
tests/
│
├── login_test.robot
📄 login_test.robot
*** Settings ***
Library SeleniumLibrary
*** Variables ***
${URL} https://example.com/login
${BROWSER} Chrome
${USERNAME} testuser
${PASSWORD} testpass
*** Test Cases ***
Valid Login Should Succeed
Open Browser ${URL} ${BROWSER}
Input Text id=username ${USERNAME}
Input Text id=password ${PASSWORD}
Click Button id=login
Page Should Contain Element id=logout
Close Browser
Running the Test
From your terminal:
robot tests/login_test.robot
Reports
After running, Robot generates:
log.html
– detailed logreport.html
– high-level reportoutput.xml
– for integrations