To install Robot Framework, you need to pre-installed the following items:

  1. Python 2 or 3
  2. Selenium
  3. PIP
  4. PATH setting in Environment Variables

See How to Install Python, PIP, Selenium, Chrome Driver post if you already have not the above things.

Install Robot:

Open CMD as an administrator user.

Type:

pip install robotframework
pip install robotframework-selenium2library

After completion you can start working on the Robot framework.

You can simply create a .txt file and put the following codes to check the Robot framework is working or not:

*** Settings ***
Library     Selenium2Library
Suite Setup     Go to homepage
Suite Teardown  Close All Browsers

*** Variables ***
${HOMEPAGE}     http://mytestsite/wp-admin
${BROWSER}      chrome
${user}         abc@example.com
${pass}         password

*** Test Cases ***
Open Browser To Login Page
    Input Username    abc@example.com
    Input Password    password
    Submit Credentials

*** Keywords ***
Open Browser To Login Page
    Maximize Browser Window
    Open Browser    ${HOMEPAGE}    ${BROWSER}
    Login Page Should Be Open

Go to homepage
    Open Browser    ${HOMEPAGE}     ${BROWSER}

Input Username
    [Arguments]    ${username}
    Input Text    id=user_login    ${username}

Input Password
    [Arguments]    ${password}
    Input Text    id=user_pass    ${password}

Submit Credentials
    Click Button    xpath=//input[contains(@id, 'wp-submit')]

Save this code in a text file like, demo-robot.txt

Now from CMD or terminal type

pybot demo-robot.txt

It will run the script and generate the detail report, log file and other necessary output.

You can also save the file as robot file like, debo-robot.robot

It that case you need to add “C:\Python27\Lib\site-packages\robot” in your Environment Variable.

Now type the following code to run the robot script:

robot demo-robot.robot

Please Note: If you are using any IDE like Pycharm, some notification will appear after installing Robot framework, which will say that there are some plugins for Robot, do you want to install it or not. In that case you should install it in the IDE.

Advertisements