Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Robot Framework — Browser Library UI Automation Framework

A UI Automation Framework built on Robot Framework and Browser Library (Playwright-based), structured around a Page Object Model with centralised configuration, reusable resource layers, and organised test suites.

The project also contains a LegacyTests/ folder housing two legacy exploration suites — BrowserTest and NewBrowserTests — which cover individual Browser Library features and are kept as reference material.


Setup

Prerequisites: Python 3.8+

# 1. Clone the repo
git clone <repo-url>
cd BrowserLibrary_RF

# 2. Install all Python dependencies
pip install -r requirements.txt

# 3. Download Playwright browser binaries (required by Browser Library)
rfbrowser init

After rfbrowser init completes you can run the framework tests immediately:

robot --outputdir results tests/

Legacy suites only: if you also want to run LegacyTests/, install the optional libraries listed at the bottom of requirements.txt before running them.


Project Structure

BrowserLibrary_RF/
├── robot.toml                          # Central runner config (output dir, log level, env profiles)
│
├── config/
│   └── environments.resource           # Single source of truth: URLs, browser, timeouts
│
├── resources/
│   ├── base.resource                   # Browser lifecycle: Open/Close session, New/Close page
│   ├── common_keywords.robot           # Backward-compatible keywords for legacy suites
│   └── pages/                          # Page Object Model
│       ├── LoginPage.resource          # OrangeHRM login page — locators + action keywords
│       └── DashboardPage.resource      # OrangeHRM dashboard page — locators + action keywords
│
├── testdata/
│   └── orangehrm_credentials.json      # Externalised test credentials and expected values
│
├── tests/
│   ├── smoke/
│   │   └── LoginSmokeTests.robot       # Login page title, valid login, dashboard header
│   └── regression/
│       └── InvalidLoginTests.robot     # Data-driven invalid credential combinations
│
├── results/                            # robot output: output.xml, log.html, report.html
│
├── LegacyTests/
│   ├── Resource.robot                      # Legacy shared keywords (BrowserTest suites)
│   ├── BrowserTest/                        # Feature-focused reference suites
│   │   ├── Data/                           # testdata.json, LoginData.xlsx, Data.xlsx
│   │   ├── Images/                         # Reference images for ImageHorizonLibrary
│   │   ├── ParallelTests/                  # Chrome parallel test runners
│   │   └── *.robot
│   └── NewBrowserTests/                    # Numbered progressive learning suites
│       └── *.robot

Framework Layers

Layer File(s) Responsibility
Config config/environments.resource ${BASE_URL}, ${BROWSER}, ${TIMEOUT} — override at runtime with --variable
Base resources/base.resource Browser/context/page lifecycle; no test logic
Page Objects resources/pages/*.resource Locator variables + page-scoped action keywords
Test Data testdata/*.json Credentials and expected values outside test files
Tests tests/smoke/, tests/regression/ Human-readable test cases; call page-object keywords only

Libraries Used

Library Purpose
Browser Core Playwright-based browser automation
RPA.Excel.Files Excel read/write via RPA Framework
JSONLibrary JSON file parsing and manipulation
ImageHorizonLibrary Image-recognition based clicks
Dialogs Pause Execution for manual inspection
Collections List and dictionary utilities
DateTime Date/time helpers

Framework Test Suites (tests/)

Smoke — tests/smoke/LoginSmokeTests.robot

Test Tags What it verifies
Login Page Title Is Correct smoke ui Page title equals OrangeHRM
Valid Login Redirects To Dashboard smoke ui auth Valid credentials land on the dashboard
Dashboard Header Shows Correct Text smoke ui Dashboard topbar header reads Dashboard

Suite lifecycle: Open Browser Session (Suite Setup) → New Page ${LOGIN_URL} (Test Setup) → Delete All Cookies + Close Page (Test Teardown) → Close Browser Session (Suite Teardown).


Regression — tests/regression/InvalidLoginTests.robot

Data-driven via Test Template. Three credential combinations, all expected to show the "Invalid credentials" error message.

Test Username Password
Invalid Password Admin admin
Invalid Username adm admin123
Invalid Username And Password adm admin

LegacyTests/BrowserTest

Each suite targets a specific Browser Library feature. All suites share LegacyTests/Resource.robot, which provides Open Browser to … setup keywords.

Browser & Navigation

File What it covers
TestBrowser.robot First-contact test: login flow on the-internet, URL/title assertions, multi-page context
FirefoxBrowser.robot Opening a maximised Firefox browser with viewport=None
Navigation.robot Go Back / Go Forward page navigation on nopCommerce
SwitchTabs.robot Multi-tab handling: Get Page IDs, Switch Page, URL assertions across tabs

Locators & Element Interaction

File What it covers
Locators.robot CSS selectors (>, >>), id=, xpath= and the differences between them
FillText.robot Fill Text (instant paste) vs Type Text (character-by-character with delay), Clear Text
PressKeysTest.robot Press Keys for keyboard shortcuts (Control+A/C/V, Backspace, Tab, ArrowDown)
MouseClicks.robot Click With Options for double-click (clickCount=2) and right-click (button=right)
Hover.robot Hover keyword for triggering hover/dropdown menus

Assertions & Element State

File What it covers
Assertions.robot Inline getter-assertions: Get Text, Get Title, Get Url, Get Element Count, Get Element States, Get Checkbox State, Get Attribute, Get Attribute Names, Get BoundingBox, Get Property
GetTest.robot Get Attribute Names, Get Attribute, Get Text with variable storage
CheckBoxTest.robot Get Checkbox State, Check Checkbox, Uncheck Checkbox with conditional IF logic

Forms & Input Controls

File What it covers
SelectOptions.robot Get Select Options, Get Selected Options, Select Options By (index), Deselect Options
DatePicker.robot Dynamic date-picker on Turkish Airlines — calculates month difference and iterates calendar rows/columns to click the target day

Advanced Web Features

File What it covers
AlertTest.robot JavaScript alert handling with Promise To + Wait For Alert and Handle Future Dialogs
iFramesTest.robot Cross-frame element access using the >>> chained selector syntax
ShadowDomTest.robot Shadow DOM traversal using >> Pierce selector on the Polymer shop demo
DragDropTest.robot Drag And Drop and Drag And Drop By Coordinates
TableTest.robot Get Table Cell Element, Get Table Cell Index, Get Table Row Index
Scroll_Window.robot Scroll By (delta x/y with easing) and Scroll To Element

HTTP & Active Links

File What it covers
ActiveLinks.robot Http keyword to assert HTTP 200 for single and all anchor-tag links on a page

Visual & Debugging Helpers

File What it covers
HighlightTest.robot Highlight Elements with configurable duration, width, style, and color
ScreenshotTest.robot Take Screenshot with indexed filenames, full-page JPEG, and EMBED mode
ImageHorizon.robot ImageHorizonLibrary image-recognition clicks — reference images stored in Images/

Test Templates & Tags

File What it covers
TestTemplate2.robot [Template] at test level for data-driven arithmetic tests
TestTemplateForLoop.robot [Template] with FOR loop over a credential list
Tags.robot Force Tags and [Tags] for suite- and test-level tagging (smoke, regression, db)
RerunFailed.robot Minimal suite for practicing --rerunfailed CLI option

Data-Driven Tests

File What it covers
JSONData.robot Load JSON From File, Get Value From JSON, Add Object To Json, Update Value To Json using Data/testdata.json
ExcelDataReadWrite_RPA.robot Open Workbook, Read Worksheet, Create Workbook, Append Rows to Worksheet, Create Worksheet
ExcelDataUpdate_RPA.robot Drive login tests from Excel; write error messages back into cells with Set Cell Value
ExcelDataOtherKeywords_RPA.robot Rename Worksheet, Remove Worksheet, Delete/Insert Columns/Rows
ExcelTestDropDownValues.robot Read date values from Excel and populate drop-down selectors on a web form

Data Directory (LegacyTests/BrowserTest/Data/)

File Used by
testdata.json JSONData.robot — URL, credentials, user detail fields
LoginData.xlsx Excel test suites — multi-sheet workbook with login credentials
Data.xlsx ExcelTestDropDownValues.robot — date values for drop-down selection

LegacyTests/NewBrowserTests

Nine numbered suites against OrangeHRM and nopCommerce, structured as a progressive learning path. All suites share resources/common_keywords.robot, which provides Open Maximized Browser, Open Browser To Login Page, and Invalid Login to OrangeHRM.

File Site What it covers
1_OrangeHRMTest.robot OrangeHRM Suite/Test lifecycle hooks; Get Url, Get Title assertions
2_OpenBrowserTest.robot OrangeHRM New Page vs Open Browser — implicit vs. explicit browser/context
3_OpenDifferentBrowsers.robot nopCommerce New Browser with browser=chromium/firefox and channel=msedge
4_LoginLocatorsTest.robot OrangeHRM CSS attribute selectors vs XPath; shared context via Suite Setup/Teardown
5_InvalidLoginTests.robot OrangeHRM Suite-level Test Template; three invalid credential combinations
6_AdvancedTemplateTest.robot OrangeHRM [Template] combined with a FOR loop over @{INVALID_CREDENTIALS}
7_ActiveLinks.robot DemoQA Get Elements, Get Property (href), Http keyword, HTTP 200 assertions
8_InputTest.robot nopCommerce Fill Text vs Type Text with delay and clear=False parameters
9_MouseClicksTest.robot nopCommerce Click With OptionsclickCount=2 (double-click) and button=right

Demo / Target Sites

Site Used by
demo.nopcommerce.com Assertions, FillText, Hover, MouseClicks, Navigation, Locators, SelectOptions, ActiveLinks, NewBrowserTests 3/8/9
opensource-demo.orangehrmlive.com PressKeysTest, ScreenshotTest, ExcelDataUpdate, Scroll_Window, NewBrowserTests 1/2/4/5/6
demoqa.com AlertTest, iFramesTest, DragDropTest, GetTest, NewBrowserTests 7
the-internet.herokuapp.com TestBrowser, ImageHorizon
tablepress.org/demo TableTest
demo.automationtesting.in SwitchTabs
demo.guru99.com CookiesTest
turkishairlines.com DatePicker
shop.polymer-project.org ShadowDomTest

Running Tests

All commands should be run from the project root (BrowserLibrary_RF/).
Results are written to results/ as configured in robot.toml.


Run everything

robot --outputdir results tests/

Run a single folder (suite directory)

# Smoke suite only
robot --outputdir results tests/smoke/

# Regression suite only
robot --outputdir results tests/regression/

Run a single .robot file

robot --outputdir results tests/smoke/LoginSmokeTests.robot
robot --outputdir results tests/regression/InvalidLoginTests.robot

Run a single test case by name

robot --outputdir results --test "Valid Login Redirects To Dashboard" tests/
robot --outputdir results --test "Invalid Password" tests/

Use --test with a glob pattern to match multiple names:

robot --outputdir results --test "Invalid*" tests/

Run by tag

# All tests tagged 'smoke'
robot --outputdir results --include smoke tests/

# All tests tagged 'auth'
robot --outputdir results --include auth tests/

# Smoke but not auth
robot --outputdir results --include smoke --exclude auth tests/

Override browser or run headless

# Run in Firefox
robot --outputdir results --variable BROWSER:firefox tests/

# Run headless (no visible browser window)
robot --outputdir results --variable HEADLESS:true tests/

# Firefox + headless
robot --outputdir results --variable BROWSER:firefox --variable HEADLESS:true tests/

Or use the named environment profiles from robot.toml:

# CI profile (chromium, headless=true)
robotcode run --env ci tests/

# Firefox profile
robotcode run --env firefox tests/

Change the timeout at runtime

robot --outputdir results --variable TIMEOUT:20s tests/

Rerun only failed tests

# First run — save failures to output.xml
robot --outputdir results tests/

# Second run — execute only the failed tests
robot --outputdir results --rerunfailed results/output.xml tests/

# Merge both runs into a single report
rebot --merge results/output.xml results/output.xml

Run legacy BrowserTest or NewBrowserTests suites

robot --outputdir results/legacy LegacyTests/BrowserTest/
robot --outputdir results/legacy LegacyTests/NewBrowserTests/

# Single legacy file
robot --outputdir results/legacy LegacyTests/BrowserTest/Assertions.robot
robot --outputdir results/legacy LegacyTests/NewBrowserTests/5_InvalidLoginTests.robot

Dry-run (validate syntax without executing)

robot --dryrun tests/

Libraries Used

Library Purpose
Browser Core Playwright-based browser automation
RPA.Excel.Files Excel read/write via RPA Framework
JSONLibrary JSON file parsing and manipulation
ImageHorizonLibrary Image-recognition based clicks
Dialogs Pause Execution for manual inspection
Collections List and dictionary utilities
DateTime Date/time helpers

About

Robot Framework - Browser Library UI tests in PyCharm IDE

Topics

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages