← Front page

Testing Electron Applications With Robot Framework's Selenium2Library

Since Electron contains Chromium and ChromeDriver can talk to Chromium and Selenium2 is just webdriver implementation, Selenium2Library can be used to test Electron apps.

First you need to download Chromedriver and start it, preferably with --port option so we know the port for sure, but at the moment it defaults to 9515.

Then create a python file, let's say, vars.py with following content:

binary_location = {"chromeOptions": {"binary": "path/to/electron/application.exe"}}

And finally create your Robot Framework test suite, like this:

*** Settings ***
Library    Selenium2Library    run_on_failure=Log Source
Variables    vars.py

*** Test Cases ***
    Create Webdriver    Remote    desired_capabilities=${binary_location}    command_executor=http://localhost:9515
    Wait Until Page Contains Element    css=.workspace
    [Teardown]    Close All Browsers

Happy testing!