Code Monkey home page Code Monkey logo

pyselenese's Introduction

Python Selenese translator
--------------------------

Selenium IDE lets you create Selenium tests in specially structured HTML (or
"Selenese"). These can be easily run on your local machine but do not lend
themselves to being run on a server via e.g. Selenium RC.

This dynamically translates suites of Selenese tests into Python
unittest.TestCase classes, which can then be run using Selenium RC within 
the standard Python unit testing framework and using the Python Selenium 
bindings.


= Warning =

This code is still under construction. It might break randomly and does not 
currently support more than a fraction of Selenese keywords. If you'd like to
improve its behaviour then please add more methods to the class in mapper.py
to map Selenese keywords to Python-binding API calls.


= Setup =

1. Download Selenium RC http://seleniumhq.org/download/

2. Unpack the server JAR at selenium-server-X/selenium-server.jar and run it
in the background:

 java -jar selenium-server.jar

3. Check out this repository anywhere on your filesystem.

4. Unpack the Python bindings selenium-python-client-driver-X/selenium.py 
from Selenium RC and place it within this repository


= Execution =

Assuming your Selenese test suite is saved as ~/my-tests/index.html (with all 
the separate test files within ~/my-tests/ too) you can run the following at 
a command prompt:

 python main.py ~/my-tests [selenium-server]

The server defaults to "localhost"

Alternatively you can run Selenese tests alongside your other unittest test
cases using e.g:

 class OneTest(unittest.TestCase):
     # ...

 class TwoTest(unittest.TestCase):
     # ...

 ThreeTest = selenese.convert_selenese(directory_name, root_url)

This creates a ThreeTest class, just like a OneTest and TwoTest, which 
unittest will pick up on and run. Selenium IDE tests require a root_url, as
they all run within the same domain owing to browser security restrictions.
This is not encoded within the tests as it is assumed that the tests are to
be run off the same domain as the website under test.


= Testing =

PySelenese can itself be tested and contains its own internal test suite. Run:

 python test.py [selenium-server]

This should run near-silently as per a normal unittest run. Alternatively, 
tests can be run in debug mode with e.g:

 python test.py localhost debug

You should then see some debug messages, both from the conversion process and
from the tests themselves, but no failures.


= Known issues =

The main issue is that not all of Selenium's test syntax has been transcribed
in mapper.py yet. Please let me know if your tests fail on a particular 
Selenium keyword; alternatively, feel free to fork the github repository and 
add the mapping yourself.

 http://github.com/jpstacey/PySelenese

pyselenese's People

Contributors

jpstacey avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.