Note: You are looking at a static snapshot of documentation related to Robot Framework automations. The most recent documentation is at https://robocorp.com/docs

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:

tasks: Run all my tasks: shell: python -m robocorp.tasks run tasks.py

👉 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 and os.
  • 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

SourceLibrary todayWhat to useNotes
Robot FrameworkBuiltInPython default syntaxContains Robot Framework's basic control structures, type conversions etc
Robot FrameworkStringPython default syntaxLibrary for manipulating strings and verifying their contents.
Robot FrameworkCollectionsPython default syntaxContains keywords for handling lists and dictionaries.
Robot FrameworkDateTimeBuilt-in datetime or pendulumCreating and verifying date and time values as well as calculations between them
Robot FrameworkOperatingSystemBuilt-in os and/or psutilEnables performing various operating system-related tasks.
RPA FrameworkRPA.Robocorp.WorkItemsrobocorp-workitems
RPA FrameworkRPA.Robocorp.Vaultrobocorp-vault
RPA FrameworkRPA.Robocorp.Storagerobocorp-storage
RPA FrameworkRPA.Robocorp.ProcessContinue using in PythonNOTE: robocorp-controlroom library will be added later.
RPA FrameworkRPA.Browser.Playwrightrobocorp-browserWrapper for Playwright with quality of life improvements. Refer to Playwright docs for details of usage.
RPA FrameworkRPA.Windowsrobocorp-windows
RPA FrameworkRPA.Browser.SeleniumContinue using in PythonSelenium library is one of the most used RPAFW libs. While we recommend using robocorp.browser for new automations, support for this library continues.
RPA FrameworkRPA.JSONBuilt-in json
RPA FrameworkRPA.HTTPrequests
RPA FrameworkRPA.Tablespandas, numpyHandling tabular data.
RPA FrameworkRPA.FileSystemPython default syntax
RPA FrameworkRPA.Desktop.OperatingSystemBuilt-in os and/or psutil
RPA FrameworkRPA.DatabaseContinue using, or choose a Database specific Python library
RPA FrameworkRPA.Cloud.AWSboto3Amazon AWS Python SDK
RPA FrameworkRPA.Cloud.GoogleGoogle Python Client LibrariesAll Google Cloud Python libraries.
RPA FrameworkRPA.Cloud.AzureAzure Python librariesMicrosoft Azure Python libraries.
RPA FrameworkRPA.Notifiernotifiers
RPA FrameworkRPA.Salesforcesimple-salesforce
RPA FrameworkRPA.FTPBuilt-in ftplib
RPA FrameworkRPA.Archivezipfile / tarfile
RPA FrameworkRPA.Calendarpendulum or holidays
RPA FrameworkRPA.DocumentAI.*Use provider's own Python client
RPA FrameworkRPA.SAPContinue using in Python, or migrate to SapGuiLibrary
RPA FrameworkRPA.Slackslack-sdk
RPA FrameworkRPA.Cryptocryptography
RPA FrameworkRPA.MSGraphO365
RPA FrameworkRPA.Imagespillow
RPA FrameworkRPA.Netsuitenetsuitesdk
RPA FrameworkRPA.OpenAIopenai
RPA FrameworkRPA.Smartsheetsmartsheet-python-sdk
RPA FrameworkRPA.Hubspothubspot-api-client
RPA FrameworkRPA.Twittertweepy
RPA FrameworkRPA.Excel.FilesContinue using in Python
RPA FrameworkRPA.MFAContinue using in Python
RPA FrameworkRPA.PDFContinue using in Python
RPA FrameworkRPA.Email.ExchangeContinue using in Python
RPA FrameworkRPA.DesktopContinue using in Python
RPA FrameworkRPA.Email.ImapSmtpContinue using in Python
RPA FrameworkRPA.JavaAccessBridgeContinue using in Python
RPA FrameworkRPA.AssistantContinue using in Python
RPA FrameworkRPA.Outlook.ApplicationContinue using in Python
RPA FrameworkRPA.Excel.ApplicationContinue using in Python
RPA FrameworkRPA.Word.ApplicationContinue using in Python
Last edit: February 13, 2024