Your first robot
Intoduction to Robots 🤖
A brief pause to go through what we mean by a robot. In Robocorp terminology, a robot is a folder or a zip file packaged in a specific way that contains everything needed to run the automation.
All robot files share the same structure, they consist of:
- Suites — the robot files that are called when the robot runs,
- Resources — user keywords and variables that you can share between tasks and suites
- Locators — UI elements that can be interacted with in apps and web pages
- Assets and Configuration — images, code library dependencies, and robot entry points when called from Control Room
Suites allow you to structure your robots. Simple robots may have just one suite, but a more complex robot can be split into multiple suites that can be run separately from Control Room.
Each suite may have:
- Tasks — these are the actual commands that can be run for this robot
- User Keywords — reusable functionality that you use to organize your robots
- Variables — saved values, such as numbers, strings, or lists
- Settings — suite configuration
Don't worry too much about these yet, in this course we'll build just a simple robot, with one suite and one task!
If you wish to go deeper into how robots are organized, have a look at Robot structure & configuration and Basic concepts of Robot Framework.
Add log row
In the previous chapter, we created a robot. Our robot has one automatically created suite "Tasks" and one task called "Insert the sales data for the week and export it as a PDF". But since we didn't add any keywords to the robot yet, it doesn't do anything.
Note, Automation Studio creates a new suite (a robot file) called
Tasksfor you automatically. You can create more tasks from the menu in the top-left corner of the editor that says
Suite "Tasks". You can use suites to split up complex robots into separate parts. For a simple robot, one suite is enough.
In Automation Studio robots are built by dragging keywords and control structures (
If, etc) from the left sidebar to the main editor area in the middle. You can use both library keywords and create your own user keywords, which let you reuse code between different tasks. For each keyword, you can see brief documentation by hovering on them in the left sidebar:
After you've dragged a keyword, you type in keyword arguments by clicking on a keyword and filling in the appropriate fields in the right-side "Properties" panel. Some common arguments can be also edited in the middle area of the editor.
To complete the task, let's add the
Log keyword to the robot. Keywords provide the robot with specific skills. In this case, writing to the log. If you are familiar with programming, you can think of keywords as functions. You can adjust how the keywords work by passing arguments to them. For Log keyword, you pass in the message to log as an argument.
"Hey keyword! Take this argument and do something useful with it!"
Now, drag the "Log" keyword into your task and type "Done." into its message field.
Great! You've now added the first keyword into your robot!
We'll discuss the robot anatomy in more detail in the next chapter, where you will teach your robot to open the RobotSpareBin intranet in a web browser.
Run the robot
Click the "Run" button in the editor view to run your robot. While running a robot, you are taken to the run view. In this view, you can see all the keywords that get run and any errors from running.
Try clicking on the Log keyword in the run view. You can see now additional details on how the keyword was run in the panel on the right.
If you go back to the editor from the run view, you can return to a previous run from the "Run Results" menu in the top menubar.
To make using Automation Studio efficient, there is a Command Palette for quickly accessing key functionalities. You can open up a Command Palette by selecting "Open Command Palette" from the View menu or pressing ctrl-K (command-K on Mac).
What we learned
- A robot is made of one or many suites, which then contain tasks, user keywords and other assets.
- Robots are built by dragging keywords in the Automation Studio editor.
- When you run code in Automation Studio, you go to run view, where you can see information about the run.
- In Automation Studio, you can do most things related to building robots without any coding.
- Keywords are like functions in other programming languages, and they can accept arguments.
Now you've created your first robot and learned about how Automation Studio editor works! However, the robot is not yet really doing anything. Next, let's make the robot open a website.