Permalink
Find file
2222595 Oct 27, 2015
83 lines (65 sloc) 3.65 KB

Java port of the Selenium 2 (WebDriver) Python library for Robot Framework

Introduction

Selenium2Library is a web testing library for Robot Framework that leverages the Selenium 2 (WebDriver) libraries from the Selenium project. It is modeled after (and forked from) the Robot Framework SeleniumLibrary library, but re-implemented to use Selenium 2 and WebDriver technologies.

  • More information about this library can be found in the Keyword Documentation.
  • For keyword completion in RIDE you can download this Library Specs and place it in your PYTHONPATH.

This Java port of the existing Selenium2Library was created to enable the usage of a Selenium 2 library with Jython.

  • Python Selenium2Library needs Python 2.6 upwards
  • The latests stable release of Jython is 2.5.3
  • Jython 2.7b2 is a beta version
  • There seems to be only slow development of a stable Jython 2.7

Usage

This library is a direct replacement to the Python Selenium2Library. There are almost no changes necesssary to the existing code. You can execute the same testcases and keywords with Python and Jython.

If you are using the robotframework-maven-plugin you can use this library by adding the following dependency to your pom.xml:

<dependency>
    <groupId>com.github.markusbernhardt</groupId>
    <artifactId>robotframework-selenium2library-java</artifactId>
    <version>1.4.0.8</version>
    <scope>test</scope>
</dependency>

If you cannot use the robotframework-maven-plugin you can use the jar-with-dependencies, which contains all required libraries.

If you want more control and feel adventurous you could you use this jar and provide all required libraries from this list on your own.

Differences

  • Selenium Speed not implemented

    Setting the Selenium Speed is deprecated several years and not implemented in WebDriver. The Python Selenium2Library tries to emulate the old behavior. I have not implemented this emulation for the following reasons.

    • As far as I understand the emulation is broken and only works with RemoteWebDriver
    • I do not know how to implement that in a correct way with Java
    • There is a reason, why this is not implemented in WebDriver. It's a bad idea.

Demo

This is a maven project. If you have firefox installed, you can execute the unit tests with:

mvn integration-test

Getting Help

The user group for Robot Framework is the best place to get help. Consider including in the post:

  • Full description of what you are trying to do and expected outcome
  • Version number of Selenium2Library, Robot Framework, and Selenium
  • StackTraces or other debug output containing error information