Skip to main content

Script Basics

RPA scripts in Granite use the Robocorp framework with Python.

Minimal Example

The @task decorator marks the entry point.

Browser Automation

Desktop Automation

Excel Automation

Error Handling

Waiting for Elements

Best Practices

Don’t use time.sleep() everywhere. Use wait_for_element or wait_for_text for reliability.
Wrap risky operations in try/except. Take screenshots on failure.
Name functions and variables clearly. Future you will thank you.
Build and test one step at a time. Don’t write the whole script first.

Script Structure

Recommended file organization:

Next Steps

RPA Overview

Learn more about RPA

Run Logs

View execution history