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 with Browser() as browser: # Visit URL url = "http://www.google.com" browser.visit(url) browser.fill('q', 'splinter - python acceptance testing for web applications') # Find and click the 'search' button button = browser.find_by_name('btnG') # Interact with elements button.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")
Note: if you don’t provide any driver to the
firefox will be used.
- simple api
- multiple webdrivers (chrome, firefox, zopetestbrowser, remote webdriver, Django, Flask)
- css and xpath selectors
- support for iframes and alerts
Basic browsing and interactions¶
Browser based drivers¶
The following drivers open a browser to run your actions:
The following drivers don’t open a browser to run your actions (but each has its own dependencies, check the specific docs for each driver):