Skip to content
Permalink
master
Go to file
 
 
Cannot retrieve contributors at this time
182 lines (137 sloc) 4.4 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

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

Features

  • simple api
  • multiple webdrivers (chrome, firefox, zopetestbrowser, remote webdriver, Django, Flask)
  • css and xpath selectors
  • support for iframes and alerts
  • can execute javascript
  • works with ajax and async javascript

Getting started

Basic browsing and interactions

JavaScript support

Walking on...

Drivers

Browser based drivers

The following drivers open a browser to run your actions:

Headless drivers

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):

Remote driver

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

Get in touch and contribute

.. toctree::
   :caption: Getting Started
   :hidden:

   why
   install
   tutorial
.. toctree::
   :caption: Browsing and Interactions
   :hidden:

   browser
   finding
   mouse-interaction
   elements-in-the-page
   matchers
   cookies
   screenshot
.. toctree::
   :caption: JavaScript
   :hidden:

   javascript
.. toctree::
   :caption: Drivers
   :hidden:

   drivers/chrome
   drivers/firefox
   drivers/remote
   drivers/zope.testbrowser
   drivers/django
   drivers/flask
.. toctree::
   :caption: More
   :hidden:

   http-status-code-and-exception
   http-proxies
   iframes-and-alerts
   api/index
   selenium-keys
.. toctree::
  :caption: Changelog
  :maxdepth: 2
  :glob:

  news
.. toctree::
   :caption: Get in touch and contribute
   :hidden:

   community
   contribute
   contribute/writing-new-drivers
   contribute/setting-up-your-development-environment
You can’t perform that action at this time.