splinter is an open source tool for testing web applications using Python. It lets you automate browser actions, such as visiting URLs and interacting with their items.
from splinter import Browser
browser = Browser()
browser.visit('http://google.com')
browser.fill('q', 'splinter - python acceptance testing for web applications')
browser.find_by_name('btnK').click()
if browser.is_text_present('splinter.readthedocs.io'):
print("Yes, the official website was found!")
else:
print("No, it wasn't found... We need to improve our SEO techniques")
browser.quit()
Note: if you don't provide any driver argument to the Browser
function, firefox
will be used (Browser function documentation).
- pytest-splinter, Splinter plugin for the py.test runner.
Support for page objects is available through the following package:
- PyPOM, A base page object model for use with Selenium or Splinter functional tests.
- pypom_form, A PyPOM based package that provides declarative schema based form interaction for page object models compatible with Splinter.
- salad, a nice mix of great BDD ingredients (splinter + lettuce integration)
- behave-django, BDD testing in Django using Behave. Works well with splinter.