Switching from Robot Framework to Python
This page outlines the tasks to follow when switching from Robot Framework to Python in writing your automations, as well as tips and links to relevant resources. If you are at all familiar with Python, the change is simple!
- Complete the Python automation certification courses to gain an overview of the platform.
- Update to the latest version of the Robocorp Code extension, and familiarise yourself with the new browser and Windows inspector tooling. Start e.g. with the videos on Browser Inspector and Windows Inspector.
- Adopt the Python project templates instead of Robot Framework templates.
- The project structure remains unchanged, just that instead of
.robot
files, you'll only have.py
files. - There are no changes in Control Room, or in how you are managing your automation workflows or their outputs.
Here are some pointers for the biggest differences:
👉 When configuring tasks in robot.yaml
the tasks commands are slightly different but simpler. For example this would run all tasks from tasks.py
file:
👉 Add robocorp library to the dependencies in conda.yaml
to leverage all the functionality of our platform in Python. For example, this will bring the loved Task logging to Python automations.
👉 Inside your Python file use @task
-decorator to declare your tasks. This also adds the logging so you'll get a comprehensive log.html
report, just like in Robot Framework. So for everything you had under *** Tasks ***
in your Robot Framework bots, you'll need a @task
in Python. Control Room treats these two things alike, so no changes are needed on that side.
👉 For those accustomed to the keyword syntax of Robot Framework, we have good news! They all work the same way, just with a bit of changes in the names. All the keywords of RPA Framework libraries work the same way, just with this small difference: If you had Read Worksheet As Table
before, in Python it will be read_worksheet_as_table
. For defining custom keywords the same logic applies! Instead of under *** Keywords ***
creating a keyword Fill and submit the form
, you now just create Python method for example like this: def fill_and_submit_form(row):
.
👉 The basic control structures and variable references of Robot Framework are all available in Python, and should not be a problem for anyone with a little bit of background in Python. In all fairness, getting the string conditiionals right with Python is so much easier than it used to be! 😎
👉 For the core functionality of Robocorp platform (Vault, Asset Storage, Work Items), we've introduced Python-only libraries under robocorp
namespace. We recommend using them, as the developer experience in Python is much smoother! Check out the example bots in Portal for reference.
👉 Check the recommendations for automation library usage and the library mappings table below on which libraries to use for your use cases. We keep on updating the table, so refer back often.
👉 Use ReMark to help! Remember to describe your desired outputs in detail, and give small enough snippets to ocnvert at once.
Development recommendation
The following table lists all current RPA Framework and commonly used Robot Framework capabilities and our current recommendation on what to use for building new automation workflows on Python.
Follow this general practice, and look at the details from the table below:
- Robot Framework libraries are largely obsolete, as their functionality is covered by Python language's basic structures or very commonly used libraries like
DateTime
andos
. - RPA Framework libraries dealing with Robocorp platform are replaced by equivalent libs in the
robocorp
namespace. - RPA Framework libraries that have been thin wrappers for a Python package will be deprecated over time. These deprecations will be notified separately at a later stage. Look for the table, and adopt the equivalent Python package at your convenience.
- For any browser automation, we recommend starting to use
robocorp.browser
instead of RPA.Browser.Selenium or RPA.Browser.Playwright. We realise the effort required to migrate old Selenium automations to the new way – thus, we will keep supporting the old library in Python for now. - Windows automation is now best done with the new
robocorp.windows
. We recommend using it instead of RPA.Windows. - For all the rest, keep on using RPA Framework in Python.
Library mappings
Source | Library today | What to use | Notes |
---|---|---|---|
Robot Framework | BuiltIn | Python default syntax | Contains Robot Framework's basic control structures, type conversions etc |
Robot Framework | String | Python default syntax | Library for manipulating strings and verifying their contents. |
Robot Framework | Collections | Python default syntax | Contains keywords for handling lists and dictionaries. |
Robot Framework | DateTime | Built-in datetime or pendulum | Creating and verifying date and time values as well as calculations between them |
Robot Framework | OperatingSystem | Built-in os and/or psutil | Enables performing various operating system-related tasks. |
RPA Framework | RPA.Robocorp.WorkItems | robocorp-workitems | |
RPA Framework | RPA.Robocorp.Vault | robocorp-vault | |
RPA Framework | RPA.Robocorp.Storage | robocorp-storage | |
RPA Framework | RPA.Robocorp.Process | Continue using in Python | NOTE: robocorp-controlroom library will be added later. |
RPA Framework | RPA.Browser.Playwright | robocorp-browser | Wrapper for Playwright with quality of life improvements. Refer to Playwright docs for details of usage. |
RPA Framework | RPA.Windows | robocorp-windows | |
RPA Framework | RPA.Browser.Selenium | Continue using in Python | Selenium library is one of the most used RPAFW libs. While we recommend using robocorp.browser for new automations, support for this library continues. |
RPA Framework | RPA.JSON | Built-in json | |
RPA Framework | RPA.HTTP | requests | |
RPA Framework | RPA.Tables | pandas, numpy | Handling tabular data. |
RPA Framework | RPA.FileSystem | Python default syntax | |
RPA Framework | RPA.Desktop.OperatingSystem | Built-in os and/or psutil | |
RPA Framework | RPA.Database | Continue using, or choose a Database specific Python library | |
RPA Framework | RPA.Cloud.AWS | boto3 | Amazon AWS Python SDK |
RPA Framework | RPA.Cloud.Google | Google Python Client Libraries | All Google Cloud Python libraries. |
RPA Framework | RPA.Cloud.Azure | Azure Python libraries | Microsoft Azure Python libraries. |
RPA Framework | RPA.Notifier | notifiers | |
RPA Framework | RPA.Salesforce | simple-salesforce | |
RPA Framework | RPA.FTP | Built-in ftplib | |
RPA Framework | RPA.Archive | zipfile / tarfile | |
RPA Framework | RPA.Calendar | pendulum or holidays | |
RPA Framework | RPA.DocumentAI.* | Use provider's own Python client | |
RPA Framework | RPA.SAP | Continue using in Python, or migrate to SapGuiLibrary | |
RPA Framework | RPA.Slack | slack-sdk | |
RPA Framework | RPA.Crypto | cryptography | |
RPA Framework | RPA.MSGraph | O365 | |
RPA Framework | RPA.Images | pillow | |
RPA Framework | RPA.Netsuite | netsuitesdk | |
RPA Framework | RPA.OpenAI | openai | |
RPA Framework | RPA.Smartsheet | smartsheet-python-sdk | |
RPA Framework | RPA.Hubspot | hubspot-api-client | |
RPA Framework | RPA.Twitter | tweepy | |
RPA Framework | RPA.Excel.Files | Continue using in Python | |
RPA Framework | RPA.MFA | Continue using in Python | |
RPA Framework | RPA.PDF | Continue using in Python | |
RPA Framework | RPA.Email.Exchange | Continue using in Python | |
RPA Framework | RPA.Desktop | Continue using in Python | |
RPA Framework | RPA.Email.ImapSmtp | Continue using in Python | |
RPA Framework | RPA.JavaAccessBridge | Continue using in Python | |
RPA Framework | RPA.Assistant | Continue using in Python | |
RPA Framework | RPA.Outlook.Application | Continue using in Python | |
RPA Framework | RPA.Excel.Application | Continue using in Python | |
RPA Framework | RPA.Word.Application | Continue using in Python |