The slick-webdriver-python project (source on github, package available from pypi) is a wrapper around the python webdriver client bindings. It makes test code simpler and more maintainable by providing:
- Wrapping all actions with log statements (using python’s builtin logging framework) that detail everything it’s doing
- Providing a nice readable api, making your tests readable
- Waiting for elements to exist (with customizable timeout) so that you don’t have to
- Providing a Page api that allows for easy organization of locators
- Page api allows for flat (Page -> locator) and nested (FrameworkElement -> Page -> Container -> Locator) api
- No need to instantiate every page class individually (avoiding boilerplate code)
- Event based api where you can add your own pre and post actions as part of standard calls (like taking a screenshot on click)
- more good tidbits
Full documentation (including examples) is available on this site.
What does a test using this fabulous framework look like? Let me show you:
The test is written so the code can be read, easily modified if something in the page is changed, and allow for code reuse (page classes). Normally page classes would be held in a different module for better organization. This is what is referred to in the documentation as the “static page class model”. There is also a different way to structure page classes that allows for nesting of containers (page classes) to make a hierarchy and enable code completion in IDEs.