Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Short article on using python to build a repl for selendroid.

selendroid repl

This document describes how to setup a repl for selendroid based on Python. It uses the Selenium Python bindings.


  • Installion and Configuration

  • Use the repl with selendroid

Installion and Configuration

I’m using Python version 2.7.x on my Mac. The following packages you have to install:

sudo easy_install selenium
sudo pip install rlcompleter
sudo easy_install readline

In order to enable code completion you have to configure your ~/.pythonrc:

    import readline
except ImportError:
    print "Module readline not available."
    import rlcompleter
    readline.parse_and_bind("tab: complete")

Next step is to configure your shell:

export PYTHONSTARTUP=~/.pythonrc

Use the repl with selendroid

After you have installed and configured your system you can use the repl. Please start first the selendroid-standalone server (please note that this example is based on the selendroid-test-app):

java -jar selendroid-standalone-0.8.0-with-dependencies.jar -app selendroid-test-app-0.8.0.apk

Please open the Python interpreter just by typing:


To use Selenium Python client bindings you have to import them:

from selenium import webdriver;

The test session can be started via:

driver=webdriver.Remote(desired_capabilities={'aut': 'io.selendroid.testapp:0.8.0'});

This will create a new test session and the driver is available under the variable driver. So if you want to get the current url, you can type:


and press TAB and then you will get recommendations about what methods are available.

Action Chains

For interacting with the app based on action chains, you have to import:

from selenium.webdriver.common.action_chains import ActionChains

Then you can use them. The gestures documentation you find here.


This comment has been minimized.

Copy link
Owner Author

DominikDary commented Feb 19, 2014

Generate a html version:

asciidoctor selendroid-repl.adoc -a source-highlighter=highlightjs -b html5

Generate PDF version:

a2x -v -fpdf -darticle --fop selendroid-repl.adoc

This comment has been minimized.

Copy link

detro commented Apr 7, 2014

Note: add line to install "pip" if absent from system.


This comment has been minimized.

Copy link

detro commented Apr 7, 2014

right package name is "rlcompleter2"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.