Robot framework with selenium – Getting started

Living in this era, where automation is comming more and more bigger part of every day live. One way to use automation is by using in testing purposes. But this does not only mean that it could be used there, you are able to create automation works like clicking like buttons, sharing content and much more. One way to do this is by using Robot Framework and selenium2library.

What first

First you need to install python, then depending on your OS, it is much up to you to decide which would be the best version for you.

I used python 2.7.11, pip 8.1.2, robotframework 3.0 and robotframework-selenium2library 1.8.0. Also in order to run test in Chrome, I used chromium driver 2.25.

Actual robot code

Here is the code

*** Settings ***

Library   Selenium2Library

Suite Teardown    Close Browser

*** Variables ***
${selenium_Speed}    2

*** Keywords ***

Make selenium slower
    Set Selenium Speed    ${selenium_Speed}

*** Test Cases ***

Open Browser and go to google
    [Documentation]    this is sample document
    Make selenium slower
    Open Browser    http://google.com    chrome

Explantion

So then, in robot framework, one is able to many things in various ways.

The template is usually not in this format where all variables and keywords are located. Usually they are imported from settings parts.

  • Settings, define configurations and imports
  • Variables, custom defined values
  • Keywords, custom defined chunks where the logic of one action is defined
  • Test cases, runned test/actions

With selenium2library one is able to use browsers.

What more

Here is couple links to get started

RobotFrame work
Selenium2Library
Python RobotFramework

With robot framework as your testing partner, you have ability to more with less time and use that extra time to further develop and research.