Skip to main content

Selenium Grid managed downloads plugin for Robot Framework SeleniumLibrary

Project description

Python Package CI

"Buy Me A Coffee"

SeleniumLibrary Grid Downloader Plugin

Robot Framework Python License

GridDownloader is a SeleniumLibrary plugin for Robot Framework that retrieves files downloaded by a remote browser running on Selenium Grid.

It uses Selenium Grid managed downloads and Selenium Python's command executor, so Grid URL paths, authentication, proxies, TLS, and session handling stay aligned with Selenium itself.

Requirements

  • Python 3.10 or newer
  • Robot Framework 7.4.2 or newer
  • SeleniumLibrary 6.9.0 or newer
  • Selenium 4.29.0 through 4.44.x, matching the SeleniumLibrary 6.9.0 supported range
  • Selenium Grid 4 with managed downloads enabled on the Node:
java -jar selenium-server-<version>.jar node --enable-managed-downloads true

Selenium Grid managed downloads currently support Chrome, Edge, and Firefox. Files must be listed or downloaded while the browser session is still active because Grid cleans the session download directory when the session ends.

Install

pip install -U robotframework-selenium-grid-downloader

Keywords Documentation

Keywords documentation can be found here.

Example Usage

*** Settings ***
Library   SeleniumLibrary  plugins=GridDownloader
Test Teardown  Close All Browsers

*** Variables ***
${BROWSER}           chrome
${URL}               https://www.example.com
${OPTIONS}           platform_name="windows"
${GRID_URL}          http://grid.example.com:4444/wd/hub
${DOWNLOAD_LINK}     xpath=//a[@id='download']
${FILENAME}          file1.txt
${EXPECTED_CONTENT}  Hello World

*** Test Cases ***
Download File And Check Content
    Open Browser    ${URL}    ${BROWSER}    remote_url=${GRID_URL}    options=${OPTIONS}
    Click Element   ${DOWNLOAD_LINK}
    Wait Until File Is Available To Download    ${FILENAME}    timeout=30 seconds    wait_step=1 second
    @{downloaded_files}=    Get List Of Downloaded Files
    Should Contain    ${downloaded_files}    ${FILENAME}
    ${content}=    Download File From Grid    ${FILENAME}
    ${content_text}=    Evaluate    $content.decode("utf-8")
    Should Be Equal As Strings    ${content_text}    ${EXPECTED_CONTENT}
    Delete Downloaded Files From Grid

Capability Activation

By default, the plugin wraps SeleniumLibrary's Open Browser keyword and adds se:downloadsEnabled=True to Selenium options.

Automatic activation can be disabled:

Library   SeleniumLibrary  plugins=GridDownloader;activate_capability=No

When activation is disabled, set the capability yourself:

${OPTIONS}    enable_downloads=True
Open Browser    ${URL}    chrome    remote_url=${GRID_URL}    options=${OPTIONS}

Keywords

  • Get List Of Downloaded Files returns file names available for the active Grid session.
  • Wait Until File Is Available To Download polls the Grid session until the named file is available.
  • Download File From Grid downloads the file to Robot Framework's output directory by default and returns its bytes.
  • Delete Downloaded Files From Grid removes downloadable files for the active Grid session.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

robotframework_selenium_grid_downloader-1.0.1.tar.gz (110.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file robotframework_selenium_grid_downloader-1.0.1.tar.gz.

File metadata

File hashes

Hashes for robotframework_selenium_grid_downloader-1.0.1.tar.gz
Algorithm Hash digest
SHA256 311741d4e7b7d7da03491b25f6f9c21998f5eb682d008fa9ebafb0cd148e137a
MD5 add17b875eb1dfaeccd93a8484687967
BLAKE2b-256 cca95e6dc9126218872329893cc1d385f7a0080e1facc3904b4e57385ae21759

See more details on using hashes here.

File details

Details for the file robotframework_selenium_grid_downloader-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for robotframework_selenium_grid_downloader-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7110cef2caa301df5346c1991dcdec653e057564bd3a12b9721b1a519c5edb71
MD5 9c4effb8b8cb12d56cf174d2decda1e7
BLAKE2b-256 e7da8dcc5dd82263ac07b63d12e3c35347ced2fce212ba89db6c870cdc3ee476

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page