RPA Framework
RPA Framework (rpaframework) is an open-source collection of Python libraries and tools designed for Robotic Process Automation (RPA). It supports both direct Python scripting and integration with Robot Framework. As of version 31.2.0, it offers extensive capabilities for web, desktop, and API automation. The library maintains a rapid release cadence, with frequent updates and bug fixes.
Warnings
- breaking Python 3.8 support was dropped in `rpaframework` version 30.0.0. Subsequent versions (including the current) require Python 3.9.1 or newer, but less than 3.14.
- breaking Browser driver management changed significantly in `rpaframework` version 27.0.0. The direct `browser_driver_install` command from `rpaframework-core` is no longer supported for managing browser drivers.
- gotcha While `rpaframework` is a Python library, many official examples and tutorials primarily demonstrate its usage within Robot Framework (`.robot` files). This can lead to confusion when attempting direct Python scripting.
Install
-
pip install rpaframework
Imports
- Selenium
from RPA.Browser.Selenium import Selenium
- Windows
from RPA.Desktop.Windows import Windows
- PDF
from RPA.PDF import PDF
- HTTP
from RPA.HTTP import HTTP
- Tables
from RPA.Tables import Tables
Quickstart
from RPA.Browser.Selenium import Selenium
import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
def minimal_web_automation():
browser = None # Initialize browser to None for finally block
try:
browser = Selenium()
logger.info("Opening browser...")
# Ensure a suitable web driver (e.g., chromedriver) is in your PATH
# or managed by rcc for this to work.
browser.open_available_browser("https://www.robocorp.com")
logger.info("Browser opened to Robocorp.com")
browser.maximize_browser_window()
title = browser.get_title()
logger.info(f"Page title: {title}")
assert "Robocorp" in title, "Title does not contain 'Robocorp'"
logger.info("Successfully verified page title.")
except Exception as e:
logger.error(f"An error occurred: {e}")
finally:
if browser:
logger.info("Closing browser...")
browser.close_browser()
logger.info("Browser closed.")
if __name__ == "__main__":
minimal_web_automation()