Selene - Concise API for Selenium in Python¶
(Selenide port in Python)
Main features:
- Concise API for Selenium
- jQuery-style selectors
- Ajax support
- PageObjects support
- Automatic driver management
Selene was inspired by Selenide from Java world.
Tests with Selene can be built either in a simple straightforward “selenide’ style or with PageObjects composed from Widgets i.e. reusable element components.
Installation¶
latest release version¶
$ pip install selene
latest development version¶
$ git clone https://github.com/yashaka/selene.git
$ python setup.py install
latest published pre-release version¶
$ pip install selene --pre
Quick Start¶
Basic Usage: 4 pillars of Selene¶
All Selene API consists just from 4 pillars:
- Browser Actions (including finding elements)
- Custom Selectors
- Assertion Conditions
- Custom Configuration
And one more not mandatory bonus:
- concise jquery-style shortcuts for finding elements
All pillars are reflected in corresponding selene python modules and their methods.
from selene.api import *
browser.open_url('https://todomvc4tasj.herokuapp.com')
s("#new-todo").should(be.blank)
s("#new-todo").set_value(1).press_enter()
ss("#todo-list>li").should(have.exact_texts("1"))