cobrateam

splinter: Automate Web Browser Interactions in Python

Splinter provides a Python API for automating browser interactions in web application tests. Use it to exercise pages through drivers such as Selenium, or when you want a higher-level interface that can still access Selenium directly.

Stars
2.8k
Forks
511
Stars, last 8 days
+0

Our take

Health score

37/100

How it is scored
Activity
20
Community
86
Issues
21
Pull requests
21

+0 stars in the last 8 days

  • More contributors than 77% of the projects we track

Overview

Splinter is a Python library for automating web browsers, particularly for testing web applications. It gives test code a consistent interface for visiting pages, locating elements, entering text, and clicking controls, reducing the need to handle browser interactions directly.

It is suited to teams writing acceptance or integration tests that need to check behavior through a browser. Its driver options include Selenium and integrations for Django, Flask, and ZopeTestBrowser. When the higher-level API is insufficient, code can access Selenium directly.

Key Features

  • Provides a Python API for browser actions such as visiting pages, filling fields, and clicking elements.
  • Supports multiple automation drivers, including Selenium, Django, Flask, and ZopeTestBrowser.
  • Offers access to lower-level Selenium functionality when needed.
  • Includes helpers for checking whether text appears on a page.
  • Has a separate pytest plugin, pytest-splinter, for use with the pytest runner.
  • Supports page objects through the separate Stere package.

Use Cases

  • Python developers can write browser-based acceptance tests for web applications.
  • QA engineers can automate user journeys, such as submitting forms and checking resulting page content.
  • Django or Flask developers can use the supported drivers to test application pages.
  • Test authors who want a higher-level browser API but need Selenium-specific operations can use both interfaces.

Getting Started

Install Splinter with pip install splinter, then follow the installation guide and tutorial. See the README for an example and links to the documentation.

Alternatives

  • Selenium: Selenium provides direct, language-neutral WebDriver browser automation, while Splinter offers a higher-level Python API that can use Selenium.
  • shortest: Shortest uses TypeScript, natural-language test instructions, Claude, and Playwright for end-to-end tests; Splinter provides a Python browser-automation API.
ProjectLanguageLicenseStarsStatus
splinterPythonBSD-3-Clause2.8kNot checked yet
seleniumJavaApache-2.034.5kActive
shortestTypeScriptMIT5.7kQuiet

Considerations

  • Browser automation requires an appropriate driver and browser setup for the chosen backend. Consult the documentation for driver-specific installation details.
  • The project provides an API over browser automation tools; it does not remove the need to understand the selected driver for advanced use.
  • pytest integration and page-object support are provided by separate projects, pytest-splinter and Stere.

Found this useful?

Share it with someone who would like splinter.

Comparisons