Simple robot

Get the code and run this example in your favorite editor on our Portal!

This simple Robot Framework robot opens a web page, stores some text content, and takes a screenshot of an image element on the web page.

The robot written in Robot Framework

This version of the robot (tasks.robot) uses Robot Framework syntax:

# ## Simple web scraper robot
# Opens a web page and stores some content.

*** Settings ***
Documentation     A simple web scraper robot.
...               Opens a website.
...               Stores the web page text in a file in the output directory.
...               Saves a screenshot of an element in the output directory.
Library           RPA.Browser.Selenium
Library           RPA.FileSystem

*** Variables ***

*** Tasks ***
Store Web Page Content
    Open Available Browser    ${URL}
    ${text}=    Get Text    scroller
    Create File
    ...    ${CURDIR}${/}output${/}text.txt
    ...    ${text}
    ...    overwrite=True
    ...    css:.img-fluid
    ...    ${CURDIR}${/}output${/}screenshot.png
    [Teardown]    Close Browser

The robot written in Python

For comparison, this is the same robot written in Python (

from RPA.Browser.Selenium import Selenium
from RPA.FileSystem import FileSystem

browser = Selenium()
file_system = FileSystem()
url = ""

def store_web_page_content():
    text = browser.get_text("scroller")
    file_system.create_file("output/text.txt", text, overwrite=True)
    browser.screenshot("css:.img-fluid", "output/screenshot.png")

def main():

if __name__ == "__main__":

Learn more about the libraries mentioned on this page: