Skip to content

Latest commit

 

History

History
122 lines (90 loc) · 3.63 KB

index.rst

File metadata and controls

122 lines (90 loc) · 3.63 KB

Splinter

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.

Sample code

python

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 Browser function, firefox will be used.

Features

  • simple api
  • multi webdrivers (chrome webdriver, firefox webdriver, phantomjs webdriver, zopetestbrowser, remote webdriver)
  • css and xpath selectors
  • support to iframe and alert
  • execute javascript
  • works with ajax and async javascript

what's new in splinter? </news>

Getting started

  • Why use Splinter </why>
  • Installation </install>
  • Quick tutorial </tutorial>

Basic browsing and interactions

  • Browser and navigation </browser>
  • Finding elements </finding>
  • Mouse interactions </mouse-interaction>
  • Interacting with elements and forms </elements-in-the-page>
  • Verify the presence of texts and elements in a page, with matchers </matchers>
  • Cookies manipulation </cookies>
  • Take screenshot </screenshot>

JavaScript support

  • Executing JavaScript </javascript>

Walking on...

  • Dealing with HTTP status code and exceptions </http-status-code-and-exception>
  • Using HTTP proxies </http-proxies>
  • Interacting with iframes, alerts and prompts </iframes-and-alerts>
  • Full API documentation </api/index>

Drivers

Browser based drivers

The following drivers open a browser to run your actions:

  • Chrome WebDriver </drivers/chrome>
  • Firefox WebDriver </drivers/firefox>
  • Remote WebDriver </drivers/remote>

Headless drivers

The following drivers don't open a browser to run your actions (but has its own dependencies, check the specific docs for each driver):

  • Chrome WebDriver </drivers/chrome>
  • Firefox WebDriver </drivers/firefox>
  • Phantomjs WebDriver </drivers/phantomjs>
  • zope.testbrowser </drivers/zope.testbrowser>
  • django client </drivers/django>
  • flask client </drivers/flask>

Remote driver

The remote driver uses Selenium Remote to control a web browser on a remote machine.

  • Remote WebDriver </drivers/remote>

Get in touch and contribute

  • Community </community>
  • Contribute </contribute>
  • Writing new drivers </contribute/writing-new-drivers>
  • Setting up your splinter development environment </contribute/setting-up-your-development-environment>