Simple robot

This robot is included in our downloadable example robots. You can also find the code at the example robots repository.

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.

Run this robot locally in Robocorp Lab

You can run this robot on your local machine using Robocorp Lab:

  1. Set up your development environment.
  2. Download the example robots.
  3. Open the simple-web-scraper example.
  4. Open the tasks.robot file and run it.
  5. Try the Python version of the same robot! Open the file and run it.

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
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 import Browser
from RPA.FileSystem import FileSystem

browser = Browser()
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__":