Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

Robot Framework DomRetryLibrary

A Robot Framework library with AI-powered fallback for locator variables, enhancing test reliability by using OpenAI to dynamically generate element locators when primary locators fail.

What's New in Version 4.0.0

  • Major improvement in reliability with a complete redesign of XPath generation strategy
  • New ID-First approach that prioritizes direct element selection using unique attributes
  • Simplified selectors that don't break with complex DOM structures or forms
  • Optimized for modern web applications with dynamic and nested elements

Installation

Install the library using pip:

pip install robotframework-domretrylibrary

Usage

Import the library in your Robot Framework test file:

*** Settings ***
Library           SeleniumLibrary
Library           DomRetryLibrary

Define your locators and AI fallback descriptions:

*** Variables ***
${USERNAME_FIELD}      css=#username_id
${AI_USERNAME_FIELD}   the username input field

Use the AI fallback in your tests (either with variable name or resolved variable):

*** Test Cases ***
Login Test
    Open Browser    https://example.com    chrome
    # Both syntaxes work in version 3.1.0+
    AI Fallback Locator    Input Text    USERNAME_FIELD    myusername
    # OR directly use the resolved variable
    AI Fallback Locator    Input Text    ${USERNAME_FIELD}    myusername
    Close Browser

You can also use custom keywords with fallback:

*** Keywords ***
Wait And Input Text
    [Arguments]    ${locator}    ${text}    ${timeout}=10
    [Documentation]    Input text with AI fallback if the primary locator fails
    ${status}    ${error}=    Run Keyword And Ignore Error    Input Text    ${locator}    ${text}
    Run Keyword If    '${status}' == 'FAIL'    AI Fallback Locator    Input Text    ${locator}    ${text}

How The New Selectors Work (v4.0.0+)

The library now uses a prioritized approach to find elements:

  1. ID-First: If an element has an ID, use it directly: //*[@id='login-button']
  2. Test Attributes: Look for testing-specific attributes: //*[@data-test='username']
  3. Form Attributes: For inputs, use name/placeholder: //*[@placeholder='Enter username']
  4. Meaningful Classes: Only if needed: //*[contains(@class, 'login-button')]

This approach is much more reliable than complex hierarchical selectors and works even in deeply nested DOM structures with forms and dynamic elements.

API Key Setup

Store your OpenAI API key in a .env file or provide it when initializing the library:

*** Settings ***
Library    DomRetryLibrary    api_key=${OPENAI_API_KEY}

License

MIT

Metadata

Release files for robotframework-domretrylibrary 4.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for robotframework-domretrylibrary 4.0.1
File Size Uploaded
robotframework_domretrylibrary-4.0.1.tar.gz 18.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for robotframework-domretrylibrary 4.0.1
File Interpreter ABI Platform
robotframework_domretrylibrary-4.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 33.6 kB

Release files / robotframework_domretrylibrary-4.0.1.tar.gz

Download URL robotframework_domretrylibrary-4.0.1.tar.gz
Size 18.2 kB
Tags Source
SHA-256 checksum
How to use checksums
205814829f8a6b5ba03686b68e373c4b6fd11ce5318048629d170945da92626f
BLAKE2b-256 checksum
How to use checksums
d25a7fb9f658267c52ae36bf157b73f5f1df668183fcce054878b05002872945
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.6

Release files / robotframework_domretrylibrary-4.0.1-py3-none-any.whl

Download URL robotframework_domretrylibrary-4.0.1-py3-none-any.whl
Size 15.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e115a3819a82f0f98b0f9825fd2b61cbc8b38920334ce1ff6865a48d03d5cf57
BLAKE2b-256 checksum
How to use checksums
dd1e6357b8d5b6614bc301ae238908bdaa76e224d1e86dc8fe97a996fd43fb3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

4.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page