How to run first robot test on windows machine.

  • Download and Install latest python version for windows
  • Create “virtual environments” with their own directories structure
  • Install Robotframework and SeleniumLibrary
  • Choose your web browser where you want run robot test
  • Run first robot test
Download and install python

check installed python version from command line.

python --version
Create “virtual environments”

Create folder “mydevenv”

c:\>C:\_SDK\Python\Python39\python -m venv c:\mydevenv\

add “c:\mydevenv\Scripts” into SYSTEM Variable PATH

create file C:\mydevenv\requirements_p3.txt

robotframework
robotframework-seleniumlibrary

install libraries with command

C:\mydevenv\Scripts>pip3 install -r C:\mydevenv\requirements_p3.txt

check installed version

C:\mydevenv\Scripts>pip3 -list

I will use Chrome browser so I need to install Chrome browser and Chromedriver. Location You always need same version of ChromeDriver with Chrome Browser like in my case 85.XXX.

Result I have downloaded file “Chromedriver.exe” in “C:\mydevenv\Scripts”

If you want some need more information and ensure how to autoupdate Chromebrowser click here.

Run our first robot test.

Create file c:\robot-test\google.robot

*** Settings ***
Documentation    This is a basic test
Library          SeleniumLibrary 
# https://robotframework.org/SeleniumLibrary/SeleniumLibrary.html

*** Variables ***
${url}        https://www.google.com
${browser}    chrome
${text}       css:input[name=q]
${expected_result}    Test


*** Test Cases ***


User fill in the Search text box
    [Documentation]             The user search 'Test' 
    set log level               trace
    open browser                ${url}                     ${browser}
    wait until page contains    ${url}
    input text                  ${text}                    Test
    press keys                  ${text}                    RETURN
    wait until page contains    ${expected_result}
    sleep                       5s
    close browser

and run the test with command

c:\robot-tests\robot google.robot

for using VS code you can use extension Robot Framework Intellisense with settings.

in File\preferences\settings\ find in user “rfLanguageServer.libraries”

"   "rfLanguageServer.libraries": [
    
        "SeleniumLibrary-3.3.1",
    ]
]

Leave a Reply

Close Menu