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

Taking Robot Framework 5 into use

Required steps for using Robot Framework 5 features

Updating conda.yaml to include these minimum package versions will enable the use of all the Robot Framework 5 features.

NOTE. Due to minimum dependency requirements, you NEED to upgrade all the packages you are using from the table to these minimum versions. Otherwise, the environment build will fail!

Minimum package versions needed:

PackageVersionComment
rpaframework14.1.1
rpaframework-aws2.0.0
rpaframework-dialogs2.0.0If installed separately.
rpaframework-google4.0.0
rpaframework-pdf3.0.0If installed separately.
rpaframework-recognition3.0.0
rpaframework-windows4.0.0If installed separately.

An example conda.yaml:

channels: - conda-forge dependencies: - python=3.9.16 - pip=22.1.2 - pip: - rpaframework==24.0.0

History of Robot Framework major releases

Robot Framework is one of the core languages with which Robocorp automation robots can be developed. The other one is pure Python. Robot Framework has always been included in the rpaframework package starting from Robot Framework release 3.

The previous major Robot Framework release 4 introduced concepts such as IF-ELSE and FOR loops into the code syntax. These have been in use since rpaframework 9.0.0 release.

What is new in Robot Framework 5?

Starting from rpaframework version 14.1.1, the next major Robot Framework release 5 and its features are available for Robot Framework based robots.

List of the most important new features:

You can find more technical information in Robot Framework 5 release notes.

Migrating an existing robot into Robot Framework 5 syntax

Existing robots do not need to take new features into use, but in some cases, new features make the syntax cleaner and the code itself more robust. For example, when using the TRY-EXCEPT-FINALLY block, there will be a clear section to handle error situations (EXCEPT) and a section to handle closing/teardown actions (FINALLY).

An example of a basic template to catch errors:

*** Settings *** Documentation Template robot main suite. Library Collections Library MyLibrary Resource keywords.robot Variables MyVariables.py *** Tasks *** Example Task TRY Example Keyword Example Python Keyword Log ${TODAY} EXCEPT Log Error handling and reporting could be done here. FINALLY Log To Console Finally Done. END

Replacing deprecated Exit For Loop (If)

This is an example of deprecated usage:

*** Keywords *** Looping FOR ${x} IN @{stuff} Exit For Loop If ${x} == 2 Log using ${x} END

Using default IF branching with Robot Framework 5:

*** Keywords *** Looping FOR ${x} IN @{stuff} IF ${x} == 2 BREAK END Log using ${x} END

Using the new inline IF statement with Robot Framework 5:

*** Keywords *** Looping FOR ${x} IN @{stuff} IF ${x} == 2 BREAK Log using ${x} END

Replacing deprecated Continue For Loop (If)

This is an example of deprecated usage:

*** Keywords *** Looping FOR ${x} IN @{stuff} Continue For Loop If ${x} == 2 Log using ${x} END

Using default IF branching with Robot Framework 5:

*** Keywords *** Looping FOR ${x} IN @{stuff} IF ${x} == 2 CONTINUE END END

Using the new inline IF statement with Robot Framework 5:

*** Keywords *** Looping FOR ${x} IN @{stuff} IF ${x} == 2 CONTINUE END

Replacing deprecated Return From Keyword (If)

This is an example of deprecated usage:

*** Keywords *** My keyword Return From Keyword ${TRUE} Another keyword [Arguments] ${arg} Return From Keyword If ${arg} > 3 ${FALSE}

Returning with Robot Framework 5:

*** Keywords *** My keyword RETURN ${TRUE} Another keyword [Arguments] ${arg} IF ${arg} > 3 RETURN

Replacing deprecated Run Keyword Unless

This is an example of deprecated usage:

*** Keywords *** My keyword Log My Keyword implementation *** Tasks *** Minimal Task ${result}= Run Keyword Unless ${val} > 1 My Keyword

Better with Robot Framework 5:

*** Keywords *** My keyword Log My Keyword implementation RETURN ${TRUE} *** Tasks *** Minimal Task ${result} IF ${val} <= 1 My Keyword

Fixing possible problems with Exit/Continue For Loop keyword

Using Exit/Continue For Loop from within a user keyword is no longer supported.

This will NOT work with Robot Framework 5:

*** Keywords *** Looping FOR ${x} IN @{stuff} Keyword END Keyword Exit For Loop

Working example (although deprecated). Exit/Continue For Loop can now be used only directly within FOR loop:

*** Keywords *** Looping FOR ${x} IN @{stuff} Continue For Loop If ${x} == 1 Exit For Loop If ${x} == 2 END

The better implementation with Robot Framework 5:

*** Keywords *** Looping FOR ${x} IN @{stuff} IF ${x} == 1 CONTINUE IF ${x} == 2 BREAK END

Fixing possible problems with Run Keyword And Expect Error keyword

Previously keyword allowed regular expression pattern to match the beginning of the error message. Now the pattern must match the whole error message.

This will NOT work with Robot Framework 5:

Run Keyword And Expect Error REGEXP: Start Fail Start and end

This needs to be replaced with:

Run Keyword And Expect Error REGEXP: Start.* Fail Start and end

What should I do if I encounter problems with Robot Framework 5?

Contact us on Developer Slack community so that we can look into the issue.

If something does not seem to work with Robot Framework 5, you can pin the previous version in your conda.yaml file:

channels: - conda-forge dependencies: - python=3.7.5 - pip=20.1 - pip: - rpaframework==14.1.1 - robotframework==4.1.3
Last edit: May 17, 2022