Splinter Docs
Splinter Docs
Release 0.18.1
andrews medina
1 Sample code 3
2 Features 5
2.1 Why use Splinter? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.2 Installation Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.3 Splinter Tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.4 Browser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.5 Finding elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.6 Mouse interactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.7 Interacting with elements in the page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.8 Matchers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.9 Cookies manipulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.10 Take screenshot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.11 Take element screenshot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.12 Take html snapshot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.13 Executing javascript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.14 Chrome WebDriver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.15 Firefox WebDriver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
2.16 Edge WebDriver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
2.17 Remote WebDriver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
2.18 zope.testbrowser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
2.19 Django . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
2.20 Flask . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
2.21 Dealing with HTTP status code and exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
2.22 Using HTTP Proxies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
2.23 Frames, alerts and prompts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
2.24 API Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
2.25 Selenium Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
2.26 Changelog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
2.27 Community . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
2.28 Contribute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
2.29 Writing new splinter drivers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
2.30 Setting up your splinter development environment . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Index 93
i
ii
splinter Documentation, Release 0.18.1
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 elements.
Getting Started 1
splinter Documentation, Release 0.18.1
2 Getting Started
CHAPTER 1
Sample code
Note: if you don’t provide any driver to the Browser function, firefox will be used.
3
splinter Documentation, Release 0.18.1
Features
• Simple API
• Support for multiple drivers
• Support for iframes and alerts
• Can execute javascript
• Works with ajax and async javascript
Splinter is an abstraction layer on top of existing browser automation tools such as Selenium and zope.testbrowser. It
has a high-level API that makes it easy to write automated tests of web applications.
For example, to fill out a form field with Splinter:
browser.fill('username', 'janedoe')
elem = browser.find_element.by_name('username')
elem.send_keys('janedoe')
Because Splinter is an abstraction layer, it supports multiple web automation backends. With Splinter, you can use
the same test code to do browser-based testing with Selenium as the backend and “headless” testing (no GUI) with
zope.testbrowser as the backend.
Splinter has drivers for browser-based testing on:
• Chrome
• Firefox
• Browsers on remote machines
5
splinter Documentation, Release 0.18.1
Splinter officially supports Python versions 3.6+ for Selenium 3, Django, Flask, and zope.testbrowser.
For Selenium 4, Python versions 3.7+ are supported.
To install the latest release, run the following command in the terminal:
Splinter’s source code is hosted on GitHub. You can clone the repository using git:
Once you have a copy of the source code, you can manually install the package:
$ cd splinter
$ python setup.py install
6 Chapter 2. Features
splinter Documentation, Release 0.18.1
Note: if you don’t provide any driver argument to the Browser function, firefox will be used (Browser function
documentation).
Visit any website using the browser.visit method. Let’s go to Google search page:
browser.visit('http://google.com')
After a page is loaded, you can perform actions, such as clicking, filling text input, checking radio and checkbox. Let’s
fill Google’s search field with splinter - python acceptance testing for web applications:
browser.fill('q', 'splinter - python acceptance testing for web applications')
Tell Splinter which button should be pressed. A button - or any other element - can be identified using its css, xpath,
id, tag or name.
In order to find Google’s search button, do:
button = browser.find_by_name('btnK')
Note that this btnK was found looking at Google’s page source code.
With the button in hands, we can then press it:
button.click()
Note: Both steps presented above could be joined in a single line, such as:
browser.find_by_name('btnK').click()
2.3.5 Find out that Splinter official website is in the search results
After pressing the button, you can check if Splinter official website is among the search responses. This can be done
like this:
if browser.is_text_present('splinter.readthedocs.io'):
print("Yes, found it! :)")
else:
print("No, didn't find it :(")
In this case, we are just printing something. You might use assertions, if you’re writing tests.
browser.quit()
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()
2.4 Browser
Or, you can use it by a context manager, through the with statement:
This last example will create a new browser window and close it when the cursor reaches the code outside the with
statement, automatically.
splinter supports the following drivers: * Chrome * Firefox * Browsers on remote machines * zope.testbrowser *
Django client * Flask client
The following examples create new Browser instances for specific drivers:
browser = Browser('chrome')
browser = Browser('firefox')
browser = Browser('zope.testbrowser')
8 Chapter 2. Features
splinter Documentation, Release 0.18.1
browser.visit('http://cobrateam.info')
The visit method takes only a single parameter - the url to be visited.
You can visit a site protected with basic HTTP authentication by providing the username and password in the url.
browser.visit('http://username:[email protected]/protected')
You can manage multiple windows (such as popups) through the windows object:
window = browser.windows[0]
window.is_current # boolean - whether window is current active window
window.is_current = True # set this window to be current window
window.next # the next window
window.prev # the previous window
window.close() # close this window
window.close_others() # close all windows except this one
This window management interface is not compatible with the undocumented interface exposed in v0.6.0 and earlier.
browser.reload()
You can move back and forward through your browsing history using the back and forward methods:
browser.visit('http://cobrateam.info')
browser.visit('https://splinter.readthedocs.io')
browser.back()
browser.forward()
2.4.5 Browser.title
You can get the title of the visited page using the title attribute:
browser.title
2.4. Browser 9
splinter Documentation, Release 0.18.1
You can use the html attribute to get the html content of the visited page:
browser.html
browser.url
Splinter provides 6 methods for finding elements in the page, one for each selector type: css, xpath, tag, name,
id, value, text. Examples:
browser.find_by_css('h1')
browser.find_by_xpath('//h1')
browser.find_by_tag('h1')
browser.find_by_name('name')
browser.find_by_text('Hello World!')
browser.find_by_id('firstheader')
browser.find_by_value('query')
Each of these methods returns a list with the found elements. You can get the first found element with the first
shortcut:
first_found = browser.find_by_name('name').first
There’s also the last shortcut – obviously, it returns the last found element:
last_found = browser.find_by_name('name').last
You also can use an index to get the desired element in the list of found elements:
second_found = browser.find_by_name('name')[1]
A web page should have only one id, so the find_by_id method returns always a list with just one element.
10 Chapter 2. Features
splinter Documentation, Release 0.18.1
If you want to target only links on a page, you can use the methods provided in the links namespace. This in available
at both the browser and element level.
Examples:
links_found = browser.find_by_css('.main').links.find_by_href('http://example.com')
links_found = browser.find_by_css('.main').links.find_by_partial_href('example')
As the other find_* methods, these returns a list of all found elements.
Finding methods are chainable, so you can find the descendants of a previously found element.
divs = browser.find_by_tag("div")
within_elements = divs.first.find_by_name("name")
If an element is not found, the find_* methods return an empty list. But if you try to access an element in this list,
the method will raise the splinter.exceptions.ElementDoesNotExist exception.
Note: Most mouse interaction currently works only on Chrome driver and Firefox 27.0.1.
Splinter provides some methods for mouse interactions with elements in the page. This feature is useful to test if an
element appears on mouse over and disappears on mouse out (eg.: subitems of a menu).
It’s also possible to send a click, double click or right click to the element.
Here is a simple example: imagine you have this jQuery event for mouse over and out:
$('.menu-links').mouseover(function(){
$(this).find('.subitem').show();
});
$('.menu-links').mouseout(function(){
$(this).find('.subitem').hide();
});
browser.find_by_css('.menu-links').mouse_over()
# Code to check if the subitem is visible...
browser.find_by_css('.menu-links').mouse_out()
2.6.1 mouse_over
browser.find_by_tag('h1').mouse_over()
2.6.2 mouse_out
browser.find_by_tag('h1').mouse_out()
2.6.3 click
browser.find_by_tag('h1').click()
2.6.4 double_click
browser.find_by_tag('h1').double_click()
2.6.5 right_click
browser.find_by_tag('h1').right_click()
2.6.6 drag_and_drop
Yes, you can drag an element and drop it to another element! The example below drags the <h1>...</h1> element
and drop it to a container element (identified by a CSS class).
draggable = browser.find_by_tag('h1')
target = browser.find_by_css('.container')
draggable.drag_and_drop(target)
12 Chapter 2. Features
splinter Documentation, Release 0.18.1
browser.find_by_css('h1').first.value
or
element = browser.find_by_css('h1').first
element.value
You can click in links. To click in links by href, partial href, text or partial text you can use this. IMPORTANT: These
methods return the first element always.
browser.links.find_by_href('http://www.the_site.com/my_link').click()
or
browser.links.find_by_partial_href('my_link').click()
or
browser.links.find_by_text('my link').click()
or
You can click in buttons. Splinter follows any redirects, and submits forms associated with buttons.
browser.find_by_name('send').first.click()
To trigger JavaScript events, like KeyDown or KeyUp, you can use the type method.
If you pass the argument slowly=True to the type method you can interact with the page on every key pressed. Useful
for testing field’s autocompletion (the browser will wait until next iteration to type the subsequent key).
To check if an element is visible or invisible, use the visible property. For instance:
browser.find_by_css('h1').first.visible
To check if an element has a className, use the has_class method. For instance:
browser.find_by_css('.content').first.has_class('content')
Don’t you like to always use first when selecting an element for clicking, for example:
browser.find_by_css('a.my-website').first.click()
You can invoke any Element method on ElementList and it will be proxied to the first element of the list. So
the two lines below are equivalent:
assert browser.find_by_css('a.banner').first.visible
assert browser.find_by_css('a.banner').visible
The shadow_root property provides access to the ShadowRootElement object. ShadowRootElement implements the
find_by_<x> methods.
shadow_root = browser.find_by_css('a.my-website').first.shadow_root
elements = shadow_root.find_by_css('.my-elements')
2.8 Matchers
When working with AJAX and asynchronous JavaScript, it’s common to have elements which are not present
in the HTML code (they are created with JavaScript, dynamically). In this case you can use the methods
14 Chapter 2. Features
splinter Documentation, Release 0.18.1
is_element_present and is_text_present to check the existence of an element or text – Splinter will
load the HTML and JavaScript in the browser and the check will be performed before processing JavaScript.
There is also the optional argument wait_time (given in seconds) – it’s a timeout: if the verification method gets
True it will return the result (even if the wait_time is not over), if it doesn’t get True, the method will wait until
the wait_time is over (so it’ll return the result).
The method is_text_present is responsible for checking if a text is present in the page content. It returns True
or False.
browser = Browser()
browser.visit('https://splinter.readthedocs.io/')
browser.is_text_present('splinter') # True
browser.is_text_present('splinter', wait_time=10) # True, using wait_time
browser.is_text_present('text not present') # False
There’s also a method to check if the text is not present: is_text_not_present. It works the same way but
returns True if the text is not present.
Splinter provides 6 methods to check the presence of elements in the page, one for each selector type: css, xpath,
tag, name, id, value, text. Examples:
browser.is_element_present_by_css('h1')
browser.is_element_present_by_xpath('//h1')
browser.is_element_present_by_tag('h1')
browser.is_element_present_by_name('name')
browser.is_element_present_by_text('Hello World!')
browser.is_element_present_by_id('firstheader')
browser.is_element_present_by_value('query')
browser.is_element_present_by_value('query', wait_time=10) # using wait_time
As expected, these methods returns True if the element is present and False if it is not present.
There’s also the negative forms of these methods, as in is_text_present:
browser.is_element_not_present_by_css('h6')
browser.is_element_not_present_by_xpath('//h6')
browser.is_element_not_present_by_tag('h6')
browser.is_element_not_present_by_name('unexisting-name')
browser.is_element_not_present_by_text('Not here :(')
browser.is_element_not_present_by_id('unexisting-header')
browser.is_element_not_present_by_id('unexisting-header', wait_time=10) # using wait_
˓→time
2.8. Matchers 15
splinter Documentation, Release 0.18.1
There are two methods to check if the element is visible or hidden in the current page using either the selector type
css or xpath. It returns True if the element is visible and False if the element in not visible.
browser.is_element_visible_by_css('h5')
browser.is_element_visible_by_css('h5', wait_time=10)
browser.is_element_visible_by_xpath('//h5')
It is possible to manipulate cookies using the cookies attribute from a Browser instance. The cookies attribute is an
instance of the CookieManager class that manipulates cookies (ie: adding and deleting).
browser.cookies.add({'cookie_name': 'cookie_value'})
cookies = browser.cookies.all()
browser.cookies.delete_all()
For more details check the API reference of the CookieManager class.
Extra Arguments
Each driver accepts various parameters when creating cookies. These can be used with browser.cookies.add as extra
arguments. For example, WebDriver can use path, domain, secure, and expiry:
:: browser.cookies.add({‘cookie_name’: ‘cookie_value’}, path=’/cookiePath’)
16 Chapter 2. Features
splinter Documentation, Release 0.18.1
browser = Browser()
screenshot_path = browser.screenshot('absolute_path/your_screenshot.png')
You should use the absolute path to save a screenshot. If you don’t use an absolute path, the screenshot will be saved
in a temporary file.
Take a full view screenshot:
browser = Browser()
screenshot_path = browser.screenshot('absolute_path/your_screenshot.png', full=True)
Some text input actions cannot be “typed” thru browser.fill(), like new lines and tab characters. Below is en
example how to work around this using browser.execute_script(). This is also much faster than browser.
fill() as there is no simulated key typing delay, making it suitable for longer texts.
Dependencies
To use Chrome, the python bindings for Selenium 3 or Selenium 4 must be installed.
When splinter is installed via pip, the selenium3 or selenium4 extra argument can be provided. This will automatically
install the latest version of Selenium 3 or Selenium 4, respectively.
Mac OS X
Linux
Go to the download page on the Chromium project and choose the correct version for your Linux installation. Then
extract the downloaded file in a directory in the PATH (e.g. /usr/bin). You can also extract it to any directory and
add that directory to the PATH:
18 Chapter 2. Features
splinter Documentation, Release 0.18.1
Linux 64bits
cd $HOME/Downloads
wget https://chromedriver.storage.googleapis.com/2.41/chromedriver_linux64.zip
unzip chromedriver_linux64.zip
mkdir -p $HOME/bin
mv chromedriver $HOME/bin
echo "export PATH=$PATH:$HOME/bin" >> $HOME/.bash_profile
Windows
Note: We don’t provide official support for Windows, but you can try it by yourself.
All you need to do is go to download page on Selenium project and choose “ChromeDriver server for win”. Your
browser will download a zip file, extract it and add the .exe file to your PATH.
If you don’t know how to add an executable to the PATH on Windows, check these link out:
• Environment variables
• How to manage environment variables in Windows XP
• How to manage environment variables in Windows 8 & 10
Usage
To use the Chrome driver, pass the string chrome when you create the Browser instance:
Note: if you don’t provide any driver to the Browser function, firefox will be used.
Note: if you have trouble with $HOME/.bash_profile, you can try $HOME/.bashrc.
Headless mode
Starting with Chrome 59, Chrome can run in a headless mode. Further Information: google developers updates
To use headless mode, pass the headless argument when creating a new Browser instance.
Incognito mode
To use Chrome’s incognito mode, pass the incognito argument when creating a Browser instance.
Emulation mode
Chrome options can be passed to customize Chrome’s behaviour; it is then possible to leverage the experimental
emulation mode.
Further Information: chrome driver documentation
Chrome can also be used from a custom path. Pass the executable path as a dictionary to the **kwargs argument. The
dictionary should be set up with executable_path as the key and the value set to the path to the executable file.
API docs
attach_file(name, value)
Fill the field identified by name with the content specified by value.
Parameters
• name (str) – name of the element to enter text into.
• value (str) – Value to enter into the element.
back()
The browser will navigate to the previous URL in the history.
If there is no previous URL, this method does nothing.
check(name)
Check a checkbox by its name.
Parameters name (str) – name of the element to check.
20 Chapter 2. Features
splinter Documentation, Release 0.18.1
Example
>>> browser.check("agree-with-terms")
If you call browser.check n times, the checkbox keeps checked, it never get unchecked.
To uncheck a checkbox, take a look in the uncheck method.
choose(name, value)
Choose a value in a radio buttons group.
Parameters
• name (str) – name of the element to enter text into.
• value (str) – Value to choose.
Example
You have two radio buttons in a page, with the name gender and values ‘F’ and ‘M’.
>>> browser.choose('gender', 'F')
Example
execute_script(script, *args)
Execute a piece of JavaScript in the browser.
Parameters script (str) – The piece of JavaScript to execute.
Example
fill(name, value)
Fill the field identified by name with the content specified by value.
Parameters
• name (str) – name of the element to enter text into.
• value (str) – Value to enter into the element.
22 Chapter 2. Features
splinter Documentation, Release 0.18.1
Parameters
• id (str) – id for the element.
• wait_time (int) – Number of seconds to search.
Returns True if the element is not present and False if is present.
Return type bool
is_element_not_present_by_name(name, wait_time=None)
Verify if an element is not present in the current page.
Parameters
• name (str) – name of the element.
• wait_time (int) – Number of seconds to search.
Returns True if the element is not present and False if is present.
Return type bool
is_element_not_present_by_tag(tag, wait_time=None)
Verify if an element is not present in the current page.
Parameters
• tag (str) – tag of the element.
• wait_time (int) – Number of seconds to search.
Returns True if the element is not present and False if is present.
Return type bool
is_element_not_present_by_text(text, wait_time=None)
Verify if an element is not present in the current page.
Parameters
• text (str) – text in the element.
• wait_time (int) – Number of seconds to search.
Returns True if the element is not present and False if is present.
Return type bool
is_element_not_present_by_value(value, wait_time=None)
Verify if an element is not present in the current page.
Parameters
• value (str) – value in the element.
• wait_time (int) – Number of seconds to search.
Returns True if the element is not present and False if is present.
Return type bool
is_element_not_present_by_xpath(xpath, wait_time=None)
Verify if an element is not present in the current page.
Parameters
• xpath (str) – xpath of the element.
• wait_time (int) – Number of seconds to search.
24 Chapter 2. Features
splinter Documentation, Release 0.18.1
is_element_present_by_value(value, wait_time=None)
Verify if an element is present in the current page.
Parameters
• value (str) – value in the element.
• wait_time (int) – Number of seconds to search.
Returns True if the element is present and False if is not present.
Return type bool
is_element_present_by_xpath(xpath, wait_time=None)
Verify if an element is present in the current page.
Parameters
• xpath (str) – xpath of the element.
• wait_time (int) – Number of seconds to search.
Returns True if the element is present and False if is not present.
Return type bool
is_text_present(text, wait_time=None)
Check if a piece of text is on the page.
Parameters
• text (str) – text to use in the search query.
• wait_time (int) – Number of seconds to search for the text.
Returns True if finds a match for the text and False if not.
Return type bool
new_tab(url: str) → None
The browser will navigate to the given URL in a new tab.
Parameters url (str) – URL path.
quit()
Quit the browser, closing its windows (if it has one).
reload()
Revisits the current URL.
screenshot(name=”, suffix=’.png’, full=False, unique_file=True)
Take a screenshot of the current page and save it locally.
Parameters
• name (str) – File name for the screenshot.
• suffix (str) – File extension for the screenshot.
• full (bool) – If the screenshot should be full screen or not.
• unique_file (bool) – If true, the filename will include a path to the system temp
directory and extra characters at the end to ensure the file is unique.
Returns Full file name of the created screenshot.
Return type str
26 Chapter 2. Features
splinter Documentation, Release 0.18.1
select(name, value)
Select an <option> element in an <select> element using the name of the <select> and the
value of the <option>.
Parameters
• name (str) – name of the option element.
• value (str) – Value to select.
Example
title
Title of current page.
type(name, value, slowly=False)
Type a value into an element.
It’s useful to test javascript events like keyPress, keyUp, keyDown, etc.
Parameters
• name (str) – name of the element to enter text into.
• value (str) – Value to enter into the element.
• slowly (bool) – If True, this function returns an iterator which will type one character
per iteration.
uncheck(name)
Uncheck a checkbox by its name.
Parameters name (str) – name of the element to uncheck.
Example
>>> browser.uncheck("send-me-emails")
If you call brower.uncheck n times, the checkbox keeps unchecked, it never get checked.
To check a checkbox, take a look in the check method.
url
URL of current page.
visit(url)
Use the browser to navigate to the given URL.
Parameters url (str) – URL path.
• Mozilla Firefox
• Geckodriver
Geckodriver must also be available on your operating system’s PATH environment variable.
Dependencies
To use Firefox, the python bindings for Selenium 3 or Selenium 4 must be installed.
When splinter is installed via pip, the selenium3 or selenium4 extra argument can be provided. This will automatically
install the latest version of Selenium 3 or Selenium 4, respectively.
Mac OS X
Usage
To use the Firefox driver, pass the string firefox when you create the Browser instance:
Note: if you don’t provide any driver to Browser function, firefox will be used.
Headless mode
Incognito mode
To use Firefox’s incognito mode, pass the incognito argument when creating a Browser instance.
28 Chapter 2. Features
splinter Documentation, Release 0.18.1
Specify Profile
You can specify a Firefox profile for using on Browser function using the profile keyword (passing the name of
the profile as a str instance):
If you don’t specify a profile, a new temporary profile will be created (and deleted when you close the browser).
Firefox Extensions
An extension for firefox is a .xpi archive. To use an extension in Firefox webdriver profile you need to give the path
of the extension, using the extensions keyword (passing the extensions as a list instance):
After the browser is closed, extensions will be deleted from the profile, even if the profile is not a temporary one.
Selenium Capabilities
You can pass any selenium read-write DesiredCapabilities parameters for Firefox.
API docs
attach_file(name, value)
Fill the field identified by name with the content specified by value.
Parameters
• name (str) – name of the element to enter text into.
• value (str) – Value to enter into the element.
back()
The browser will navigate to the previous URL in the history.
If there is no previous URL, this method does nothing.
check(name)
Check a checkbox by its name.
Parameters name (str) – name of the element to check.
Example
>>> browser.check("agree-with-terms")
If you call browser.check n times, the checkbox keeps checked, it never get unchecked.
To uncheck a checkbox, take a look in the uncheck method.
choose(name, value)
Choose a value in a radio buttons group.
Parameters
• name (str) – name of the element to enter text into.
• value (str) – Value to choose.
Example
You have two radio buttons in a page, with the name gender and values ‘F’ and ‘M’.
>>> browser.choose('gender', 'F')
Example
execute_script(script, *args)
Execute a piece of JavaScript in the browser.
Parameters script (str) – The piece of JavaScript to execute.
Example
fill(name, value)
Fill the field identified by name with the content specified by value.
Parameters
• name (str) – name of the element to enter text into.
• value (str) – Value to enter into the element.
30 Chapter 2. Features
splinter Documentation, Release 0.18.1
32 Chapter 2. Features
splinter Documentation, Release 0.18.1
Parameters
• id (str) – id for the element.
• wait_time (int) – Number of seconds to search.
Returns True if the element is not present and False if is present.
Return type bool
is_element_not_present_by_name(name, wait_time=None)
Verify if an element is not present in the current page.
Parameters
• name (str) – name of the element.
• wait_time (int) – Number of seconds to search.
Returns True if the element is not present and False if is present.
Return type bool
is_element_not_present_by_tag(tag, wait_time=None)
Verify if an element is not present in the current page.
Parameters
• tag (str) – tag of the element.
• wait_time (int) – Number of seconds to search.
Returns True if the element is not present and False if is present.
Return type bool
is_element_not_present_by_text(text, wait_time=None)
Verify if an element is not present in the current page.
Parameters
• text (str) – text in the element.
• wait_time (int) – Number of seconds to search.
Returns True if the element is not present and False if is present.
Return type bool
is_element_not_present_by_value(value, wait_time=None)
Verify if an element is not present in the current page.
Parameters
• value (str) – value in the element.
• wait_time (int) – Number of seconds to search.
Returns True if the element is not present and False if is present.
Return type bool
is_element_not_present_by_xpath(xpath, wait_time=None)
Verify if an element is not present in the current page.
Parameters
• xpath (str) – xpath of the element.
• wait_time (int) – Number of seconds to search.
34 Chapter 2. Features
splinter Documentation, Release 0.18.1
is_element_present_by_value(value, wait_time=None)
Verify if an element is present in the current page.
Parameters
• value (str) – value in the element.
• wait_time (int) – Number of seconds to search.
Returns True if the element is present and False if is not present.
Return type bool
is_element_present_by_xpath(xpath, wait_time=None)
Verify if an element is present in the current page.
Parameters
• xpath (str) – xpath of the element.
• wait_time (int) – Number of seconds to search.
Returns True if the element is present and False if is not present.
Return type bool
is_text_present(text, wait_time=None)
Check if a piece of text is on the page.
Parameters
• text (str) – text to use in the search query.
• wait_time (int) – Number of seconds to search for the text.
Returns True if finds a match for the text and False if not.
Return type bool
new_tab(url: str) → None
The browser will navigate to the given URL in a new tab.
Parameters url (str) – URL path.
quit()
Quit the browser, closing its windows (if it has one).
reload()
Revisits the current URL.
screenshot(name=”, suffix=’.png’, full=False, unique_file=True)
Take a screenshot of the current page and save it locally.
Parameters
• name (str) – File name for the screenshot.
• suffix (str) – File extension for the screenshot.
• full (bool) – If the screenshot should be full screen or not.
• unique_file (bool) – If true, the filename will include a path to the system temp
directory and extra characters at the end to ensure the file is unique.
Returns Full file name of the created screenshot.
Return type str
select(name, value)
Select an <option> element in an <select> element using the name of the <select> and the
value of the <option>.
Parameters
• name (str) – name of the option element.
• value (str) – Value to select.
Example
title
Title of current page.
type(name, value, slowly=False)
Type a value into an element.
It’s useful to test javascript events like keyPress, keyUp, keyDown, etc.
Parameters
• name (str) – name of the element to enter text into.
• value (str) – Value to enter into the element.
• slowly (bool) – If True, this function returns an iterator which will type one character
per iteration.
uncheck(name)
Uncheck a checkbox by its name.
Parameters name (str) – name of the element to uncheck.
Example
>>> browser.uncheck("send-me-emails")
If you call brower.uncheck n times, the checkbox keeps unchecked, it never get checked.
To check a checkbox, take a look in the check method.
url
URL of current page.
visit(url)
Use the browser to navigate to the given URL.
Parameters url (str) – URL path.
36 Chapter 2. Features
splinter Documentation, Release 0.18.1
• Microsoft Edge
• Microsoft Edge Driver
Microsoft Edge Driver must also be available on your operating system’s PATH environment variable.
Dependencies
To use Edge, the python bindings for Selenium 3 or Selenium 4 must be installed.
When splinter is installed via pip, the selenium3 or selenium4 extra argument can be provided. This will automatically
install the latest version of Selenium 3 or Selenium 4, respectively.
Mac OS X
Modern versions of Edge (79+) are available for Mac OS X. However, no versions of Edge Legacy are available.
Linux
Neither version of Edge is available for Linux, and thus Edge WebDriver cannot be used on Linux systems.
Usage
To use the Edge driver, pass the string edge when you create the Browser instance:
Edge Options
Selenium Options can be passed to customize Edge’s behaviour through the EdgeOptions object
It must be imported from the msedge-selenium-tools package.
Headless mode
To use headless mode, pass the headless argument when creating a new Browser instance.
Incognito mode
To use Edge’s incognito mode, pass the incognito argument when creating a Browser instance.
Emulation mode
Since Selenium options can be passed to customize Edge’s behaviour; it is then possible to leverage the experimental
emulation mode.
Edge can also be used from a custom path. Pass the executable path as a dictionary to the **kwargs argument. The
dictionary should be set up with executable_path as the key and the value set to the path to the executable file.
Edge Legacy
By default, Edge WebDriver is configured to use versions of Edge built with Chromium (Version 79 and up).
To use Edge Legacy, pass the chromium argument when creating a new Browser instance.
This requires the correct version of Edge and Edge Driver to be installed.
38 Chapter 2. Features
splinter Documentation, Release 0.18.1
API docs
attach_file(name, value)
Fill the field identified by name with the content specified by value.
Parameters
• name (str) – name of the element to enter text into.
• value (str) – Value to enter into the element.
back()
The browser will navigate to the previous URL in the history.
If there is no previous URL, this method does nothing.
check(name)
Check a checkbox by its name.
Parameters name (str) – name of the element to check.
Example
>>> browser.check("agree-with-terms")
If you call browser.check n times, the checkbox keeps checked, it never get unchecked.
To uncheck a checkbox, take a look in the uncheck method.
choose(name, value)
Choose a value in a radio buttons group.
Parameters
• name (str) – name of the element to enter text into.
• value (str) – Value to choose.
Example
You have two radio buttons in a page, with the name gender and values ‘F’ and ‘M’.
Example
execute_script(script, *args)
Execute a piece of JavaScript in the browser.
Parameters script (str) – The piece of JavaScript to execute.
Example
fill(name, value)
Fill the field identified by name with the content specified by value.
Parameters
• name (str) – name of the element to enter text into.
• value (str) – Value to enter into the element.
fill_form(field_values, form_id=None, name=None, ignore_missing=False)
Fill the fields identified by name with the content specified by value in a dict.
Currently, fill_form supports the following fields: text, password, textarea, checkbox, radio and select.
Checkboxes should be specified as a boolean in the dict.
Parameters
• field_values (dict) – Values for all the fields in the form, in the pattern of {field
name: field value}
• form_id (str) – Id of the form to fill. Can be used instead of name.
• name (str) – Name of the form to fill.
• ignore_missing (bool) – Ignore missing keys in the dict.
find_by(finder, finder_kwargs=None, original_find: str = None, original_query: str = None,
wait_time: int = None)
Wrapper for finding elements.
Must be attached to a class.
Returns ElementList
find_by_css(css_selector, wait_time=None)
Return an instance of ElementList, using a CSS selector to query the current page content.
Parameters css_selector (str) – CSS Selector to use in the search query.
find_by_id(id, wait_time=None)
Find an element on the current page by its id.
Even when only one element is find, this method returns an instance of ElementList
Parameters id (str) – id to use in the search query.
40 Chapter 2. Features
splinter Documentation, Release 0.18.1
find_by_name(name, wait_time=None)
Find elements on the current page by their name.
Return an instance of ElementList.
Parameters name (str) – name to use in the search query.
find_by_tag(tag, wait_time=None)
Find all elements of a given tag in current page.
Returns an instance of ElementList
Parameters tag (str) – tag to use in the search query.
find_by_text(text=None, wait_time=None)
Find elements on the current page by their text.
Returns an instance of ElementList
Parameters text (str) – text to use in the search query.
find_by_value(value, wait_time=None)
Find elements on the current page by their value.
Returns an instance of ElementList
Parameters value (str) – value to use in the search query.
find_by_xpath(xpath, original_find=’xpath’, original_query=None, wait_time=None)
Return an instance of ElementList, using a xpath selector to query the current page content.
Parameters xpath (str) – Xpath to use in the search query.
find_option_by_text(text)
Finds <option> elements by their text.
Returns an instance of ElementList
Parameters text (str) – text to use in the search query.
find_option_by_value(value)
Find <option> elements by their value.
Returns an instance of ElementList
Parameters value (str) – value to use in the search query.
forward()
The browser will navigate to the next URL in the history.
If there is no URL to forward, this method does nothing.
get_alert(wait_time=None)
Change the context for working with alerts and prompts.
For more details, check the docs about iframes, alerts and prompts
get_iframe(frame_reference)
Change the context for working with iframes.
For more details, check the docs about iframes, alerts and prompts
html
Source of current page.
html_snapshot(name=”, suffix=’.html’, encoding=’utf-8’, unique_file=True)
Write the current html to a file.
Parameters
• name (str) – File name.
• suffix (str) – File extension.
• encoding (str) – File encoding.
• unique_file (str) – If true, the filename will include a path to the system temp di-
rectory and extra characters at the end to ensure the file is unique.
Returns Full file name of the created html snapshot.
Return type str
is_element_not_present_by_css(css_selector, wait_time=None)
Verify if an element is not present in the current page.
Parameters
• css (str) – css selector for the element.
• wait_time (int) – Number of seconds to search.
Returns True if the element is not present and False if is present.
Return type bool
is_element_not_present_by_id(id, wait_time=None)
Verify if an element is not present in the current page.
Parameters
• id (str) – id for the element.
• wait_time (int) – Number of seconds to search.
Returns True if the element is not present and False if is present.
Return type bool
is_element_not_present_by_name(name, wait_time=None)
Verify if an element is not present in the current page.
Parameters
• name (str) – name of the element.
• wait_time (int) – Number of seconds to search.
Returns True if the element is not present and False if is present.
Return type bool
is_element_not_present_by_tag(tag, wait_time=None)
Verify if an element is not present in the current page.
Parameters
• tag (str) – tag of the element.
• wait_time (int) – Number of seconds to search.
Returns True if the element is not present and False if is present.
Return type bool
is_element_not_present_by_text(text, wait_time=None)
Verify if an element is not present in the current page.
42 Chapter 2. Features
splinter Documentation, Release 0.18.1
Parameters
• text (str) – text in the element.
• wait_time (int) – Number of seconds to search.
Returns True if the element is not present and False if is present.
Return type bool
is_element_not_present_by_value(value, wait_time=None)
Verify if an element is not present in the current page.
Parameters
• value (str) – value in the element.
• wait_time (int) – Number of seconds to search.
Returns True if the element is not present and False if is present.
Return type bool
is_element_not_present_by_xpath(xpath, wait_time=None)
Verify if an element is not present in the current page.
Parameters
• xpath (str) – xpath of the element.
• wait_time (int) – Number of seconds to search.
Returns True if the element is not present and False if is present.
Return type bool
is_element_present_by_css(css_selector, wait_time=None)
Verify if an element is present in the current page.
Parameters
• css (str) – css selector for the element.
• wait_time (int) – Number of seconds to search.
Returns True if the element is present and False if is not present.
Return type bool
is_element_present_by_id(id, wait_time=None)
Verify if an element is present in the current page.
Parameters
• id (str) – id for the element.
• wait_time (int) – Number of seconds to search.
Returns True if the element is present and False if is not present.
Return type bool
is_element_present_by_name(name, wait_time=None)
Verify if an element is present in the current page.
Parameters
• name (str) – name of the element.
• wait_time (int) – Number of seconds to search.
44 Chapter 2. Features
splinter Documentation, Release 0.18.1
Example
title
Title of current page.
type(name, value, slowly=False)
Type a value into an element.
It’s useful to test javascript events like keyPress, keyUp, keyDown, etc.
Parameters
• name (str) – name of the element to enter text into.
• value (str) – Value to enter into the element.
• slowly (bool) – If True, this function returns an iterator which will type one character
per iteration.
uncheck(name)
Uncheck a checkbox by its name.
Parameters name (str) – name of the element to uncheck.
Example
>>> browser.uncheck("send-me-emails")
If you call brower.uncheck n times, the checkbox keeps unchecked, it never get checked.
To check a checkbox, take a look in the check method.
url
URL of current page.
visit(url)
Use the browser to navigate to the given URL.
Parameters url (str) – URL path.
2.17.1 Dependencies
To use Remote WebDriver, the python bindings for Selenium 3 or Selenium 4 must be installed.
When splinter is installed via pip, the selenium3 or selenium4 extra argument can be provided. This will automatically
install the latest version of Selenium 3 or Selenium 4, respectively.
To use Remote WebDriver, you need to have access to a Selenium remote WebDriver server. Setting up one of these
servers is beyond the scope of this document. However, some companies provide access to a Selenium Grid as a
service.
Usage
To use the Remote WebDriver, use driver_name="remote" when you create the Browser instance.
The browser_name argument should then be used to specify the web browser. The other arguments match Sele-
nium’s Remote WebDriver arguments.
Desired Capabilities will be set automatically based on Selenium’s defaults. These can be expanded and/or replaced
by providing your own.
The following example uses LambdaTest (a company that provides Selenium Remote WebDriver servers as a service)
to request an Chrome version 99 browser instance running on Windows 11.
with Browser(
driver_name="remote",
browser='Chrome',
command_executor=remote_server_url,
(continues on next page)
46 Chapter 2. Features
splinter Documentation, Release 0.18.1
browser.visit("https://www.lambdatest.com/selenium-playground/")
browser.find_by_text('Simple Form Demo').first.click()
The following example uses Sauce Labs (a company that provides Selenium Remote WebDriver servers as a service)
to request an Internet Explorer 9 browser instance running on Windows 7.
with Browser(
driver_name="remote",
browser='internetexplorer',
command_executor=remote_server_url,
desired_capabilities = {
'platform': 'Windows 7',
'version': '9',
'name': 'Test of IE 9 on WINDOWS',
},
keep_alive=True,
) as browser:
print("Link to job: https://saucelabs.com/jobs/{}".format(
browser.driver.session_id))
browser.visit("https://splinter.readthedocs.io")
browser.find_by_text('documentation').first.click()
2.18 zope.testbrowser
2.18.1 Dependencies
2.18.2 Usage
To use the zope.testbrowser driver, all you need to do is pass the string zope.testbrowser when you create
the Browser instance:
2.18. zope.testbrowser 47
splinter Documentation, Release 0.18.1
By default zope.testbrowser respects any robots.txt preventing access to a lot of sites. If you want to circumvent
this you can call
Note: if you don’t provide any driver to Browser function, firefox will be used.
class splinter.driver.zopetestbrowser.ZopeTestBrowser(wait_time=2)
back()
The browser will navigate to the previous URL in the history.
If there is no previous URL, this method does nothing.
check(name)
Check a checkbox by its name.
Parameters name (str) – name of the element to check.
Example
>>> browser.check("agree-with-terms")
If you call browser.check n times, the checkbox keeps checked, it never get unchecked.
To uncheck a checkbox, take a look in the uncheck method.
choose(name, value)
Choose a value in a radio buttons group.
Parameters
• name (str) – name of the element to enter text into.
• value (str) – Value to choose.
Example
You have two radio buttons in a page, with the name gender and values ‘F’ and ‘M’.
48 Chapter 2. Features
splinter Documentation, Release 0.18.1
Parameters
• name (str) – name of the element to enter text into.
• value (str) – Value to enter into the element.
fill_form(field_values, form_id=None, name=None, ignore_missing=False)
Fill the fields identified by name with the content specified by value in a dict.
Currently, fill_form supports the following fields: text, password, textarea, checkbox, radio and select.
Checkboxes should be specified as a boolean in the dict.
Parameters
• field_values (dict) – Values for all the fields in the form, in the pattern of {field
name: field value}
• form_id (str) – Id of the form to fill. Can be used instead of name.
• name (str) – Name of the form to fill.
• ignore_missing (bool) – Ignore missing keys in the dict.
find_by_css(selector)
Return an instance of ElementList, using a CSS selector to query the current page content.
Parameters css_selector (str) – CSS Selector to use in the search query.
find_by_id(id_value)
Find an element on the current page by its id.
Even when only one element is find, this method returns an instance of ElementList
Parameters id (str) – id to use in the search query.
find_by_name(name)
Find elements on the current page by their name.
Return an instance of ElementList.
Parameters name (str) – name to use in the search query.
find_by_tag(tag)
Find all elements of a given tag in current page.
Returns an instance of ElementList
Parameters tag (str) – tag to use in the search query.
find_by_text(text)
Find elements on the current page by their text.
Returns an instance of ElementList
Parameters text (str) – text to use in the search query.
find_by_value(value)
Find elements on the current page by their value.
Returns an instance of ElementList
Parameters value (str) – value to use in the search query.
find_by_xpath(xpath, original_find=None, original_query=None)
Return an instance of ElementList, using a xpath selector to query the current page content.
Parameters xpath (str) – Xpath to use in the search query.
2.18. zope.testbrowser 49
splinter Documentation, Release 0.18.1
find_option_by_text(text)
Finds <option> elements by their text.
Returns an instance of ElementList
Parameters text (str) – text to use in the search query.
find_option_by_value(value)
Find <option> elements by their value.
Returns an instance of ElementList
Parameters value (str) – value to use in the search query.
forward()
The browser will navigate to the next URL in the history.
If there is no URL to forward, this method does nothing.
get_alert() → Any
Change the context for working with alerts and prompts.
For more details, check the docs about iframes, alerts and prompts
get_iframe(name: Any) → Any
Change the context for working with iframes.
For more details, check the docs about iframes, alerts and prompts
html
Source of current page.
html_snapshot(name: str = ”, suffix: str = ’.html’, encoding: str = ’utf-8’, unique_file: bool = True)
→ str
Write the current html to a file.
Parameters
• name (str) – File name.
• suffix (str) – File extension.
• encoding (str) – File encoding.
• unique_file (str) – If true, the filename will include a path to the system temp di-
rectory and extra characters at the end to ensure the file is unique.
Returns Full file name of the created html snapshot.
Return type str
is_text_present(text, wait_time=None)
Check if a piece of text is on the page.
Parameters
• text (str) – text to use in the search query.
• wait_time (int) – Number of seconds to search for the text.
Returns True if finds a match for the text and False if not.
Return type bool
new_tab(url: str) → None
The browser will navigate to the given URL in a new tab.
Parameters url (str) – URL path.
50 Chapter 2. Features
splinter Documentation, Release 0.18.1
quit()
Quit the browser, closing its windows (if it has one).
reload()
Revisits the current URL.
screenshot(name: Optional[str] = None, suffix: Optional[str] = None, full: bool = False, unique_file:
bool = True) → str
Take a screenshot of the current page and save it locally.
Parameters
• name (str) – File name for the screenshot.
• suffix (str) – File extension for the screenshot.
• full (bool) – If the screenshot should be full screen or not.
• unique_file (bool) – If true, the filename will include a path to the system temp
directory and extra characters at the end to ensure the file is unique.
Returns Full file name of the created screenshot.
Return type str
select(name, value)
Select an <option> element in an <select> element using the name of the <select> and the
value of the <option>.
Parameters
• name (str) – name of the option element.
• value (str) – Value to select.
Example
title
Title of current page.
type(name: str, value: str, slowly: bool = False) → str
Type a value into an element.
It’s useful to test javascript events like keyPress, keyUp, keyDown, etc.
Parameters
• name (str) – name of the element to enter text into.
• value (str) – Value to enter into the element.
• slowly (bool) – If True, this function returns an iterator which will type one character
per iteration.
uncheck(name)
Uncheck a checkbox by its name.
Parameters name (str) – name of the element to uncheck.
2.18. zope.testbrowser 51
splinter Documentation, Release 0.18.1
Example
>>> browser.uncheck("send-me-emails")
If you call brower.uncheck n times, the checkbox keeps unchecked, it never get checked.
To check a checkbox, take a look in the check method.
url
URL of current page.
visit(url)
Use the browser to navigate to the given URL.
Parameters url (str) – URL path.
2.19 Django
2.19.1 Dependencies
2.19.2 Usage
To use the django driver, all you need to do is pass the string django when you create the Browser instance:
Note: if you don’t provide any driver to Browser function, firefox will be used.
back()
The browser will navigate to the previous URL in the history.
If there is no previous URL, this method does nothing.
check(name)
Check a checkbox by its name.
Parameters name (str) – name of the element to check.
52 Chapter 2. Features
splinter Documentation, Release 0.18.1
Example
>>> browser.check("agree-with-terms")
If you call browser.check n times, the checkbox keeps checked, it never get unchecked.
To uncheck a checkbox, take a look in the uncheck method.
choose(name, value)
Choose a value in a radio buttons group.
Parameters
• name (str) – name of the element to enter text into.
• value (str) – Value to choose.
Example
You have two radio buttons in a page, with the name gender and values ‘F’ and ‘M’.
2.19. Django 53
splinter Documentation, Release 0.18.1
find_by_id(id_value)
Find an element on the current page by its id.
Even when only one element is find, this method returns an instance of ElementList
Parameters id (str) – id to use in the search query.
find_by_name(name)
Find elements on the current page by their name.
Return an instance of ElementList.
Parameters name (str) – name to use in the search query.
find_by_tag(tag)
Find all elements of a given tag in current page.
Returns an instance of ElementList
Parameters tag (str) – tag to use in the search query.
find_by_text(text)
Find elements on the current page by their text.
Returns an instance of ElementList
Parameters text (str) – text to use in the search query.
find_by_value(value)
Find elements on the current page by their value.
Returns an instance of ElementList
Parameters value (str) – value to use in the search query.
find_by_xpath(xpath, original_find=None, original_query=None)
Return an instance of ElementList, using a xpath selector to query the current page content.
Parameters xpath (str) – Xpath to use in the search query.
find_option_by_text(text)
Finds <option> elements by their text.
Returns an instance of ElementList
Parameters text (str) – text to use in the search query.
find_option_by_value(value)
Find <option> elements by their value.
Returns an instance of ElementList
Parameters value (str) – value to use in the search query.
forward()
The browser will navigate to the next URL in the history.
If there is no URL to forward, this method does nothing.
get_alert() → Any
Change the context for working with alerts and prompts.
For more details, check the docs about iframes, alerts and prompts
get_iframe(name: Any) → Any
Change the context for working with iframes.
For more details, check the docs about iframes, alerts and prompts
54 Chapter 2. Features
splinter Documentation, Release 0.18.1
html
Source of current page.
html_snapshot(name: str = ”, suffix: str = ’.html’, encoding: str = ’utf-8’, unique_file: bool = True)
→ str
Write the current html to a file.
Parameters
• name (str) – File name.
• suffix (str) – File extension.
• encoding (str) – File encoding.
• unique_file (str) – If true, the filename will include a path to the system temp di-
rectory and extra characters at the end to ensure the file is unique.
Returns Full file name of the created html snapshot.
Return type str
is_text_present(text, wait_time=None)
Check if a piece of text is on the page.
Parameters
• text (str) – text to use in the search query.
• wait_time (int) – Number of seconds to search for the text.
Returns True if finds a match for the text and False if not.
Return type bool
new_tab(url: str) → None
The browser will navigate to the given URL in a new tab.
Parameters url (str) – URL path.
quit()
Quit the browser, closing its windows (if it has one).
reload()
Revisits the current URL.
screenshot(name: Optional[str] = None, suffix: Optional[str] = None, full: bool = False, unique_file:
bool = True) → str
Take a screenshot of the current page and save it locally.
Parameters
• name (str) – File name for the screenshot.
• suffix (str) – File extension for the screenshot.
• full (bool) – If the screenshot should be full screen or not.
• unique_file (bool) – If true, the filename will include a path to the system temp
directory and extra characters at the end to ensure the file is unique.
Returns Full file name of the created screenshot.
Return type str
select(name, value)
Select an <option> element in an <select> element using the name of the <select> and the
value of the <option>.
2.19. Django 55
splinter Documentation, Release 0.18.1
Parameters
• name (str) – name of the option element.
• value (str) – Value to select.
Example
title
Title of current page.
type(name: str, value: str, slowly: bool = False) → str
Type a value into an element.
It’s useful to test javascript events like keyPress, keyUp, keyDown, etc.
Parameters
• name (str) – name of the element to enter text into.
• value (str) – Value to enter into the element.
• slowly (bool) – If True, this function returns an iterator which will type one character
per iteration.
uncheck(name)
Uncheck a checkbox by its name.
Parameters name (str) – name of the element to uncheck.
Example
>>> browser.uncheck("send-me-emails")
If you call brower.uncheck n times, the checkbox keeps unchecked, it never get checked.
To check a checkbox, take a look in the check method.
url
URL of current page.
visit(url)
Use the browser to navigate to the given URL.
Parameters url (str) – URL path.
2.20 Flask
2.20.1 Dependencies
56 Chapter 2. Features
splinter Documentation, Release 0.18.1
2.20.2 Usage
To use the flask driver, you’ll need to pass the string flask and an app instances via the app keyword argument
when you create the Browser instance:
Note: if you don’t provide any driver to Browser function, firefox will be used.
When visiting pages with the Flask client, you only need to provide a path rather than a full URL. For example:
browser.visit('/my-path')
back()
The browser will navigate to the previous URL in the history.
If there is no previous URL, this method does nothing.
check(name)
Check a checkbox by its name.
Parameters name (str) – name of the element to check.
Example
>>> browser.check("agree-with-terms")
If you call browser.check n times, the checkbox keeps checked, it never get unchecked.
To uncheck a checkbox, take a look in the uncheck method.
choose(name, value)
Choose a value in a radio buttons group.
Parameters
• name (str) – name of the element to enter text into.
• value (str) – Value to choose.
Example
You have two radio buttons in a page, with the name gender and values ‘F’ and ‘M’.
2.20. Flask 57
splinter Documentation, Release 0.18.1
cookies
A CookieManager instance.
For more details, check the cookies manipulation section.
fill(name, value)
Fill the field identified by name with the content specified by value.
Parameters
• name (str) – name of the element to enter text into.
• value (str) – Value to enter into the element.
fill_form(field_values, form_id=None, name=None, ignore_missing=False)
Fill the fields identified by name with the content specified by value in a dict.
Currently, fill_form supports the following fields: text, password, textarea, checkbox, radio and select.
Checkboxes should be specified as a boolean in the dict.
Parameters
• field_values (dict) – Values for all the fields in the form, in the pattern of {field
name: field value}
• form_id (str) – Id of the form to fill. Can be used instead of name.
• name (str) – Name of the form to fill.
• ignore_missing (bool) – Ignore missing keys in the dict.
find_by_css(selector)
Return an instance of ElementList, using a CSS selector to query the current page content.
Parameters css_selector (str) – CSS Selector to use in the search query.
find_by_id(id_value)
Find an element on the current page by its id.
Even when only one element is find, this method returns an instance of ElementList
Parameters id (str) – id to use in the search query.
find_by_name(name)
Find elements on the current page by their name.
Return an instance of ElementList.
Parameters name (str) – name to use in the search query.
find_by_tag(tag)
Find all elements of a given tag in current page.
Returns an instance of ElementList
Parameters tag (str) – tag to use in the search query.
find_by_text(text)
Find elements on the current page by their text.
Returns an instance of ElementList
Parameters text (str) – text to use in the search query.
find_by_value(value)
Find elements on the current page by their value.
58 Chapter 2. Features
splinter Documentation, Release 0.18.1
2.20. Flask 59
splinter Documentation, Release 0.18.1
Returns True if finds a match for the text and False if not.
Return type bool
new_tab(url: str) → None
The browser will navigate to the given URL in a new tab.
Parameters url (str) – URL path.
quit()
Quit the browser, closing its windows (if it has one).
reload()
Revisits the current URL.
screenshot(name: Optional[str] = None, suffix: Optional[str] = None, full: bool = False, unique_file:
bool = True) → str
Take a screenshot of the current page and save it locally.
Parameters
• name (str) – File name for the screenshot.
• suffix (str) – File extension for the screenshot.
• full (bool) – If the screenshot should be full screen or not.
• unique_file (bool) – If true, the filename will include a path to the system temp
directory and extra characters at the end to ensure the file is unique.
Returns Full file name of the created screenshot.
Return type str
select(name, value)
Select an <option> element in an <select> element using the name of the <select> and the
value of the <option>.
Parameters
• name (str) – name of the option element.
• value (str) – Value to select.
Example
title
Title of current page.
type(name: str, value: str, slowly: bool = False) → str
Type a value into an element.
It’s useful to test javascript events like keyPress, keyUp, keyDown, etc.
Parameters
• name (str) – name of the element to enter text into.
• value (str) – Value to enter into the element.
• slowly (bool) – If True, this function returns an iterator which will type one character
per iteration.
60 Chapter 2. Features
splinter Documentation, Release 0.18.1
uncheck(name)
Uncheck a checkbox by its name.
Parameters name (str) – name of the element to uncheck.
Example
>>> browser.uncheck("send-me-emails")
If you call brower.uncheck n times, the checkbox keeps unchecked, it never get checked.
To check a checkbox, take a look in the check method.
url
URL of current page.
visit(url)
Use the browser to navigate to the given URL.
Parameters url (str) – URL path.
Note: After 0.8 version the webdriver (firefox, chrome) based drivers does not support http error handling.
It’s also possible to check which HTTP status code a browser.visit gets. You can use status_code.is_success
to do the work for you or you can compare the status code directly:
browser.visit('http://cobrateam.info')
browser.status_code.is_success() # True
# or
browser.status_code == 200 # True
# or
browser.status_code.code # 200
The difference between those methods is that if you get a redirect (or something that is not an HTTP error),
status_code.is_success will consider your response as successfully. The numeric status code can be ac-
cessed via status_code.code.
Unauthenticated proxies are simple, you need only configure the browser with the hostname and port.
Authenticated proxies are rather more complicated, (see RFC2617)
profile = {
'network.proxy.http': YOUR_PROXY_SERVER_HOST,
'network.proxy.http_port': YOUR_PROXY_SERVER_PORT,
'network.proxy.ssl': YOUR_PROXY_SERVER_HOST,
'network.proxy.ssl_port': YOUR_PROXY_SERVER_PORT,
'network.proxy.type': 1
}
self.browser = Browser(self.browser_type, profile_preferences=profile)
If you have access to the browser window, then the same technique will work for an authenticated proxy, but you will
have to type the username and password in manually.
If this is not possible, for example on a remote CI server, then it is not currently clear how to do this. This document
will be updated when more information is known. If you can help, please follow up on https://github.com/cobrateam/
splinter/issues/359.
You can use the get_iframe method and the with statement to interact with iframes. You can pass the iframe’s
name, id, index, or web element to get_iframe.
alert = browser.get_alert()
alert.text
alert.accept()
alert.dismiss()
prompt = browser.get_alert()
prompt.text
prompt.send_keys('text')
prompt.accept()
prompt.dismiss()
You can also use the with statement to interact with both alerts and prompts.
62 Chapter 2. Features
splinter Documentation, Release 0.18.1
If there’s no prompt or alert, get_alert will return None. Remember to always use at least one of the alert/prompt
ending methods (accept and dismiss). Otherwise, your browser instance will be frozen until you accept or dismiss the
alert/prompt correctly.
2.24.1 Browser
2.24.2 DriverAPI
class splinter.driver.DriverAPI
Basic driver API class.
back() → None
The browser will navigate to the previous URL in the history.
If there is no previous URL, this method does nothing.
check(name: str) → None
Check a checkbox by its name.
Parameters name (str) – name of the element to check.
Example
>>> browser.check("agree-with-terms")
If you call browser.check n times, the checkbox keeps checked, it never get unchecked.
To uncheck a checkbox, take a look in the uncheck method.
choose(name: str, value: str) → None
Choose a value in a radio buttons group.
Parameters
Example
You have two radio buttons in a page, with the name gender and values ‘F’ and ‘M’.
Example
Example
64 Chapter 2. Features
splinter Documentation, Release 0.18.1
get_alert() → Any
Change the context for working with alerts and prompts.
For more details, check the docs about iframes, alerts and prompts
get_iframe(name: Any) → Any
Change the context for working with iframes.
For more details, check the docs about iframes, alerts and prompts
html
Source of current page.
html_snapshot(name: str = ”, suffix: str = ’.html’, encoding: str = ’utf-8’, unique_file: bool = True)
→ str
Write the current html to a file.
Parameters
• name (str) – File name.
• suffix (str) – File extension.
• encoding (str) – File encoding.
• unique_file (str) – If true, the filename will include a path to the system temp di-
rectory and extra characters at the end to ensure the file is unique.
Returns Full file name of the created html snapshot.
Return type str
is_element_not_present_by_css(css_selector: str, wait_time: Optional[int] = None) → bool
Verify if an element is not present in the current page.
Parameters
• css (str) – css selector for the element.
• wait_time (int) – Number of seconds to search.
Returns True if the element is not present and False if is present.
Return type bool
is_element_not_present_by_id(id: str, wait_time: Optional[int] = None) → bool
Verify if an element is not present in the current page.
Parameters
• id (str) – id for the element.
• wait_time (int) – Number of seconds to search.
Returns True if the element is not present and False if is present.
Return type bool
is_element_not_present_by_name(name: str, wait_time: Optional[int] = None) → bool
Verify if an element is not present in the current page.
Parameters
• name (str) – name of the element.
• wait_time (int) – Number of seconds to search.
Returns True if the element is not present and False if is present.
66 Chapter 2. Features
splinter Documentation, Release 0.18.1
Parameters
• id (str) – id for the element.
• wait_time (int) – Number of seconds to search.
Returns True if the element is present and False if is not present.
Return type bool
is_element_present_by_name(name: str, wait_time: Optional[int] = None) → bool
Verify if an element is present in the current page.
Parameters
• name (str) – name of the element.
• wait_time (int) – Number of seconds to search.
Returns True if the element is present and False if is not present.
Return type bool
is_element_present_by_tag(tag: str, wait_time: Optional[int] = None) → bool
Verify if an element is present in the current page.
Parameters
• tag (str) – tag of the element.
• wait_time (int) – Number of seconds to search.
Returns True if the element is present and False if is not present.
Return type bool
is_element_present_by_text(text: str, wait_time: Optional[int] = None) → bool
Verify if an element is present in the current page.
Parameters
• text (str) – text in the element.
• wait_time (int) – Number of seconds to search.
Returns True if the element is present and False if is not present.
Return type bool
is_element_present_by_value(value: str, wait_time: Optional[int] = None) → bool
Verify if an element is present in the current page.
Parameters
• value (str) – value in the element.
• wait_time (int) – Number of seconds to search.
Returns True if the element is present and False if is not present.
Return type bool
is_element_present_by_xpath(xpath: str, wait_time: Optional[int] = None) → bool
Verify if an element is present in the current page.
Parameters
• xpath (str) – xpath of the element.
• wait_time (int) – Number of seconds to search.
68 Chapter 2. Features
splinter Documentation, Release 0.18.1
Example
title
Title of current page.
Example
>>> browser.uncheck("send-me-emails")
If you call brower.uncheck n times, the checkbox keeps unchecked, it never get checked.
To check a checkbox, take a look in the check method.
url
URL of current page.
visit(url: str) → None
Use the browser to navigate to the given URL.
Parameters url (str) – URL path.
2.24.3 ElementAPI
class splinter.driver.ElementAPI
Basic element API class.
Any element in the page can be represented as an instance of ElementAPI.
Once you have an instance, you can easily access attributes like a dict:
You can also interact with the instance using the methods and properties listed below.
check() → None
Check the element, if it’s “checkable” (e.g.: a checkbox).
If the element is already checked, this method does nothing. For unchecking elements, take a loot in the
uncheck method.
checked
Get the checked status of the element.
70 Chapter 2. Features
splinter Documentation, Release 0.18.1
Example
>>> element.check()
>>> assert element.checked
>>> element.uncheck()
>>> assert not element.checked
clear() → None
Reset the field value.
click() → None
Click the element.
fill(value: str) → None
Fill the element with text content.
Parameters value (str) – Value to enter into the element.
has_class(class_name: str) → bool
Indicates whether the element has the given class.
mouse_out() → None
Move the mouse away from the element.
mouse_over() → None
Move the mouse over the element.
screenshot(name: Optional[str] = None, suffix: Optional[str] = None, full: bool = False, unique_file:
bool = True) → str
Take a screenshot of the element.
select(value: str, slowly: bool = False) → None
Select an <option> element in the element using the value of the <option>.
Example
>>> element.select("NY")
shadow_root
Get the shadow root of an element’s shadow DOM.
text
All of the text within the element. HTML tags are stripped.
type(value: str, slowly: bool = False) → str
Type the value in the element.
If slowly is True, this function returns an iterator which will type one character per iteration.
It’s useful to test javascript events like keyPress, keyUp, keyDown, etc.
Example
uncheck() → None
Uncheck the element, if it’s “checkable” (e.g.: a checkbox).
If the element is already unchecked, this method does nothing. For checking elements, take a loot in the
check method.
value
Value of the element, usually a form element
visible
Get the visibility status of the element.
2.24.4 CookieManager
class splinter.cookie_manager.CookieManagerAPI(driver)
An API that specifies how a splinter driver deals with cookies.
You can add cookies using the add method, and remove one or all cookies using the delete method.
A CookieManager acts like a dict, so you can access the value of a cookie through the [] operator, passing the
cookie identifier:
>>> cookie_manager.add({'name': 'Tony'})
>>> assert cookie_manager['name'] == 'Tony'
Examples
Examples
delete(*cookies) → None
Delete one or more cookies.
You can pass all the cookies identifier that you want to delete.
If identifiers are provided, all cookies are deleted.
Parameters cookies (list) – Identifiers for each cookie to delete.
72 Chapter 2. Features
splinter Documentation, Release 0.18.1
Examples
delete_all() → None
Delete all cookies.
2.24.5 ElementList
first
An alias to the first element of the list.
Example
is_empty() → bool
Check if the ElementList is empty.
Returns True if the list is empty, else False
Return type bool
last
An alias to the last element of the list.
Example
code = None
200)
is_success()
Returns True if the response was succeed, otherwise, returns False.
reason = None
Success)
Type A message for the response (example
2.24.7 Exceptions
class splinter.exceptions.DriverNotFoundError
Exception raised when a driver is not found.
Example
class splinter.exceptions.ElementDoesNotExist
Exception raised when an element is not found in the page.
The exception is raised only when someone tries to access the element, not when the driver is finding it.
Example
With Splinter’s type() method, you can use Selenium’s Keys implementation.
browser = Browser()
browser.type(Keys.RETURN)
The full list of all supported keys can be found at the official Selenium documentation: sele-
nium.webdriver.common.keys
2.26 Changelog
74 Chapter 2. Features
splinter Documentation, Release 0.18.1
Features
Features
browser.find_by_name('name')
browser.find_by_name('name').first
browser.find_by_name('name').last
browser.find_by_name('name')[1]
An id should be unique in a web page, so find_by_id() method always returns a list with a single element.
2.26. Changelog 75
splinter Documentation, Release 0.18.1
• issue #24 remove save_and_open_page method from splinter api. This feature is out of splinter’s scope, hence
should be implemented as an external package.
• now finder methods (find_by_name, find_by_css_selector, find_by_tag, find_by_id, find_by_xpath) returns a
list with elements, to get the first element founded use first attribute
browser.find_by_name('name').first
Features
• now splinter use selenium 2.0b3 for firefox and chrome driver
• zope.testbrowser.browser dependency is not required
• new method for reload a page
• find_by_css_selector is now deprecated, use find_by_css instead
• deprecated methods now throw “DeprecationWarning”
• methods for verify if element or text is present
• find_by methods wait for element
• added support for iframes and alerts
• added more specific exception messages for not found elements
Features
• capability to handle HTTP errors (using an exception) in Selenium drivers (Firefox and Chrome)
• capability to work with HTTP status code in Selenium drivers (Firefox and Chrome)
• browsing history (back and forward methods in Browser class)
• improvements in documentation
Bugfixes
76 Chapter 2. Features
splinter Documentation, Release 0.18.1
2.26. Changelog 77
splinter Documentation, Release 0.18.1
78 Chapter 2. Features
splinter Documentation, Release 0.18.1
Added: * WebDriverElement() now implements the shadow_root property. This returns a ShadowRootElement()
object to interact with the shadow root of an element. * Failed driver imports are logged at the debug level instead
of silently ignored * browser.html_snapshot() now takes the optional unique_file argument. Setting this to False will
disable the addition of random characters to the filename.
Changed: * repr(ElementList()) now returns the repr of the internal container. * Driver.find_link_by_<x> methods
have been removed. Use Driver.links.find_by_<x>. * Screenshot taken by WebDriverElement.screenshot() now im-
plements Selenium’s element screenshot instead of cropping a full page screenshot. * Flask/Django’s back/forward
methods more accurately store browsing history * Official Python 3.6 support has been removed
Fixed: * 0.17.0 would report as 0.16.0. 0.18.0 reports correctly. * When using Firefox, extensions can now be installed
2.26. Changelog 79
splinter Documentation, Release 0.18.1
Features
• cookies manipulation
• find elements within an element
• improvements in ElementList
• you should update your selenium to 2.1.0 version and your chrome driver. See more in suport to new chrome
driver
Features
Documentation improvements
• changes on cookies manipulation. Affects only who used cookies.delete passing the cookie keyword.
Before version 0.3:
>>> driver.cookies.delete(cookie='whatever')
Now:
>>> driver.cookies.delete('whatever')
Bugfixes
• Fixed cookies behavior on Chrome driver (it was impossible to delete one cookie, Chrome was always deleting
all cookies)
80 Chapter 2. Features
splinter Documentation, Release 0.18.1
Features
• support for double click, right click, drag and drop and other mouse interactions (only Chrome driver)
• support for Python 2.5
Documentation improvements
Deprecations
• simplified name of Selenium drivers, they’re just chrome and firefox now (instead of webdriver.
chrome and webdriver.firefox). The older names were deprecated.
• changed name of mouseover and mouseout methods to mouse_over and mouse_out
IMPORTANT
The following deprecated methods will be removed in the next splinter release (0.5) from Browser classes:
• fill_in
• find_by_css_selector
• is_element_present_by_css_selector
• is_element_not_present_by_css_selector
Features
2.26. Changelog 81
splinter Documentation, Release 0.18.1
Improvements
Bugfix
Features
• added new browser method form_fill to fill all form fields in one command
Bugfixes
Features
Features
Bugfixes
Bugfixes
82 Chapter 2. Features
splinter Documentation, Release 0.18.1
Features
Features
Features
Bugfix
Features
Bugfix
2.26. Changelog 83
splinter Documentation, Release 0.18.1
Improvements
Improvement
Bugfix
Improvement
Bugfix
Improvements
Features
84 Chapter 2. Features
splinter Documentation, Release 0.18.1
Features
Bugfix
django client
2.26. Changelog 85
splinter Documentation, Release 0.18.1
86 Chapter 2. Features
splinter Documentation, Release 0.18.1
2.27 Community
#cobrateam channel on irc.freenode.net - chat with other splinter users and developers
2.27. Community 87
splinter Documentation, Release 0.18.1
Blog posts
• Django Full Stack Testing and BDD with Lettuce and Splinter
2.28 Contribute
$ make test
You can pass which test files you want to run, separated by comma, to the which variable.
You can feel free to create and pull request new branches to Splinter project. When adding support for new drivers,
we usually work in a separated branch.
Splinter documentation is written using Sphinx, which uses RST. We use the Read the Docs Sphinx Theme. Check
these tools’ docs to learn how to write docs for Splinter.
In order to build the HTML docs, just navigate to the project folder (the main folder, not the docs folder) and run the
following on the terminal:
$ make doc
The requirements for building the docs are specified in doc-requirements.txt in the project folder.
88 Chapter 2. Features
splinter Documentation, Release 0.18.1
The process of creating a new splinter browser is really simple: you just need to implement a TestCase (extending
tests.base. BaseBrowserTests) and make all tests green. For example:
Imagine you’re creating the Columbia driver, you would add the test_columbia.py file containing some code
like. . .
class ColumbiaTest(BaseBrowserTests):
@classmethod
def setUpClass(cls):
cls.browser = Browser('columbia')
# ...
Now, to make the test green, you need to implement methods provided by the DriverAPI and the ElementAPI.
Use make test to run the tests:
Setting up a splinter development environment is a really easy task. Once you have some basic development tools on
your machine, you can set up the entire environment with just one command.
macOS
If you’re a macOS user, you just need to install Xcode, which can be downloaded from Mac App Store (on Snow
Leopard or later) or from Apple website.
Linux
If you are running a Linux distribution, you need to install some basic development libraries and headers. For example,
on Ubuntu, you can easily install all of them using apt-get:
Make sure you have pip installed. We manage all splinter development dependencies with PIP, so you should use it
too.
And please, for the sake of a nice development environment, use virtualenv. If you aren’t using it yet, start now. :)
Dependencies
Once you have all development libraries installed for your OS, just install all splinter development dependencies with
make:
Note: You will need sudo only if you aren’t using virtualenv (which means you’re a really bad guy - no donuts for
you).
Also make sure you have properly configured your Chrome driver.
90 Chapter 2. Features
Python Module Index
s
splinter.browser, 63
splinter.cookie_manager, 72
splinter.driver, 63
splinter.driver.djangoclient, 52
splinter.driver.flaskclient, 56
splinter.driver.zopetestbrowser, 47
splinter.element_list, 73
splinter.exceptions, 74
splinter.request_handler.status_code,
74
91
splinter Documentation, Release 0.18.1
A check() (splinter.driver.webdriver.edge.WebDriver
add() (splinter.cookie_manager.CookieManagerAPI method), 39
method), 72 check() (splinter.driver.webdriver.firefox.WebDriver
all() (splinter.cookie_manager.CookieManagerAPI method), 29
method), 72 check() (splinter.driver.zopetestbrowser.ZopeTestBrowser
attach_file() (splin- method), 48
ter.driver.webdriver.chrome.WebDriver checked (splinter.driver.ElementAPI attribute), 70
method), 20 choose() (splinter.driver.djangoclient.DjangoClient
attach_file() (splin- method), 53
ter.driver.webdriver.edge.WebDriver method), choose() (splinter.driver.DriverAPI method), 63
39 choose() (splinter.driver.flaskclient.FlaskClient
attach_file() (splin- method), 57
ter.driver.webdriver.firefox.WebDriver method), choose() (splinter.driver.webdriver.chrome.WebDriver
29 method), 21
choose() (splinter.driver.webdriver.edge.WebDriver
B method), 39
back() (splinter.driver.djangoclient.DjangoClient choose() (splinter.driver.webdriver.firefox.WebDriver
method), 52 method), 30
back() (splinter.driver.DriverAPI method), 63 choose() (splinter.driver.zopetestbrowser.ZopeTestBrowser
back() (splinter.driver.flaskclient.FlaskClient method), method), 48
57 clear() (splinter.driver.ElementAPI method), 71
back() (splinter.driver.webdriver.chrome.WebDriver click() (splinter.driver.ElementAPI method), 71
method), 20 code (splinter.request_handler.status_code.StatusCode
back() (splinter.driver.webdriver.edge.WebDriver attribute), 73
method), 39 CookieManagerAPI (class in splin-
back() (splinter.driver.webdriver.firefox.WebDriver ter.cookie_manager), 72
method), 29 cookies (splinter.driver.djangoclient.DjangoClient at-
back() (splinter.driver.zopetestbrowser.ZopeTestBrowser tribute), 53
method), 48 cookies (splinter.driver.DriverAPI attribute), 64
Browser() (in module splinter.browser), 63 cookies (splinter.driver.flaskclient.FlaskClient at-
tribute), 57
C cookies (splinter.driver.webdriver.chrome.WebDriver
check() (splinter.driver.djangoclient.DjangoClient attribute), 21
method), 52 cookies (splinter.driver.webdriver.edge.WebDriver at-
check() (splinter.driver.DriverAPI method), 63 tribute), 39
check() (splinter.driver.ElementAPI method), 70 cookies (splinter.driver.webdriver.firefox.WebDriver
check() (splinter.driver.flaskclient.FlaskClient attribute), 30
method), 57 cookies (splinter.driver.zopetestbrowser.ZopeTestBrowser
check() (splinter.driver.webdriver.chrome.WebDriver attribute), 48
method), 20
93
splinter Documentation, Release 0.18.1
D fill() (splinter.driver.zopetestbrowser.ZopeTestBrowser
delete() (splinter.cookie_manager.CookieManagerAPI method), 48
method), 72 fill_form() (splin-
delete_all() (splin- ter.driver.djangoclient.DjangoClient method),
ter.cookie_manager.CookieManagerAPI 53
method), 73 fill_form() (splinter.driver.DriverAPI method), 64
DjangoClient (class in splinter.driver.djangoclient), fill_form() (splinter.driver.flaskclient.FlaskClient
52 method), 58
DriverAPI (class in splinter.driver), 63 fill_form() (splin-
DriverNotFoundError (class in splin- ter.driver.webdriver.chrome.WebDriver
ter.exceptions), 74 method), 22
fill_form() (splin-
E ter.driver.webdriver.edge.WebDriver method),
40
ElementAPI (class in splinter.driver), 70
fill_form() (splin-
ElementDoesNotExist (class in splin-
ter.driver.webdriver.firefox.WebDriver method),
ter.exceptions), 74
31
ElementList (class in splinter.element_list), 73
fill_form() (splin-
evaluate_script() (splinter.driver.DriverAPI
ter.driver.zopetestbrowser.ZopeTestBrowser
method), 64
method), 49
evaluate_script() (splin-
find_by() (splinter.driver.webdriver.chrome.WebDriver
ter.driver.webdriver.chrome.WebDriver
method), 22
method), 21
find_by() (splinter.driver.webdriver.edge.WebDriver
evaluate_script() (splin-
method), 40
ter.driver.webdriver.edge.WebDriver method),
find_by() (splinter.driver.webdriver.firefox.WebDriver
39
method), 31
evaluate_script() (splin-
find_by_css() (splin-
ter.driver.webdriver.firefox.WebDriver method),
ter.driver.djangoclient.DjangoClient method),
30
53
execute_script() (splinter.driver.DriverAPI
find_by_css() (splinter.driver.DriverAPI method),
method), 64
65
execute_script() (splin-
find_by_css() (splin-
ter.driver.webdriver.chrome.WebDriver
ter.driver.flaskclient.FlaskClient method),
method), 21
58
execute_script() (splin-
find_by_css() (splin-
ter.driver.webdriver.edge.WebDriver method),
ter.driver.webdriver.chrome.WebDriver
40
method), 22
execute_script() (splin-
find_by_css() (splin-
ter.driver.webdriver.firefox.WebDriver method),
ter.driver.webdriver.edge.WebDriver method),
30
40
F find_by_css() (splin-
ter.driver.webdriver.firefox.WebDriver method),
fill() (splinter.driver.djangoclient.DjangoClient
31
method), 53
find_by_css() (splin-
fill() (splinter.driver.DriverAPI method), 64
ter.driver.zopetestbrowser.ZopeTestBrowser
fill() (splinter.driver.ElementAPI method), 71
method), 49
fill() (splinter.driver.flaskclient.FlaskClient method),
find_by_id() (splin-
58
ter.driver.djangoclient.DjangoClient method),
fill() (splinter.driver.webdriver.chrome.WebDriver
53
method), 21
find_by_id() (splinter.driver.DriverAPI method), 65
fill() (splinter.driver.webdriver.edge.WebDriver
find_by_id() (splinter.driver.flaskclient.FlaskClient
method), 40
method), 58
fill() (splinter.driver.webdriver.firefox.WebDriver
find_by_id() (splin-
method), 30
ter.driver.webdriver.chrome.WebDriver
94 Index
splinter Documentation, Release 0.18.1
method), 22 65
find_by_id() (splin- find_by_text() (splin-
ter.driver.webdriver.edge.WebDriver method), ter.driver.flaskclient.FlaskClient method),
40 58
find_by_id() (splin- find_by_text() (splin-
ter.driver.webdriver.firefox.WebDriver method), ter.driver.webdriver.chrome.WebDriver
31 method), 22
find_by_id() (splin- find_by_text() (splin-
ter.driver.zopetestbrowser.ZopeTestBrowser ter.driver.webdriver.edge.WebDriver method),
method), 49 41
find_by_name() (splin- find_by_text() (splin-
ter.driver.djangoclient.DjangoClient method), ter.driver.webdriver.firefox.WebDriver method),
54 31
find_by_name() (splinter.driver.DriverAPI method), find_by_text() (splin-
65 ter.driver.zopetestbrowser.ZopeTestBrowser
find_by_name() (splin- method), 49
ter.driver.flaskclient.FlaskClient method), find_by_value() (splin-
58 ter.driver.djangoclient.DjangoClient method),
find_by_name() (splin- 54
ter.driver.webdriver.chrome.WebDriver find_by_value() (splinter.driver.DriverAPI
method), 22 method), 65
find_by_name() (splin- find_by_value() (splin-
ter.driver.webdriver.edge.WebDriver method), ter.driver.flaskclient.FlaskClient method),
40 58
find_by_name() (splin- find_by_value() (splin-
ter.driver.webdriver.firefox.WebDriver method), ter.driver.webdriver.chrome.WebDriver
31 method), 22
find_by_name() (splin- find_by_value() (splin-
ter.driver.zopetestbrowser.ZopeTestBrowser ter.driver.webdriver.edge.WebDriver method),
method), 49 41
find_by_tag() (splin- find_by_value() (splin-
ter.driver.djangoclient.DjangoClient method), ter.driver.webdriver.firefox.WebDriver method),
54 31
find_by_tag() (splinter.driver.DriverAPI method), find_by_value() (splin-
65 ter.driver.zopetestbrowser.ZopeTestBrowser
find_by_tag() (splin- method), 49
ter.driver.flaskclient.FlaskClient method), find_by_xpath() (splin-
58 ter.driver.djangoclient.DjangoClient method),
find_by_tag() (splin- 54
ter.driver.webdriver.chrome.WebDriver find_by_xpath() (splinter.driver.DriverAPI
method), 22 method), 65
find_by_tag() (splin- find_by_xpath() (splin-
ter.driver.webdriver.edge.WebDriver method), ter.driver.flaskclient.FlaskClient method),
41 59
find_by_tag() (splin- find_by_xpath() (splin-
ter.driver.webdriver.firefox.WebDriver method), ter.driver.webdriver.chrome.WebDriver
31 method), 22
find_by_tag() (splin- find_by_xpath() (splin-
ter.driver.zopetestbrowser.ZopeTestBrowser ter.driver.webdriver.edge.WebDriver method),
method), 49 41
find_by_text() (splin- find_by_xpath() (splin-
ter.driver.djangoclient.DjangoClient method), ter.driver.webdriver.firefox.WebDriver method),
54 31
find_by_text() (splinter.driver.DriverAPI method), find_by_xpath() (splin-
Index 95
splinter Documentation, Release 0.18.1
ter.driver.zopetestbrowser.ZopeTestBrowser method), 32
method), 49 forward() (splinter.driver.zopetestbrowser.ZopeTestBrowser
find_option_by_text() (splin- method), 50
ter.driver.djangoclient.DjangoClient method),
54 G
find_option_by_text() (splin- get_alert() (splin-
ter.driver.DriverAPI method), 65 ter.driver.djangoclient.DjangoClient method),
find_option_by_text() (splin- 54
ter.driver.flaskclient.FlaskClient method), get_alert() (splinter.driver.DriverAPI method), 65
59 get_alert() (splinter.driver.flaskclient.FlaskClient
find_option_by_text() (splin- method), 59
ter.driver.webdriver.chrome.WebDriver get_alert() (splin-
method), 23 ter.driver.webdriver.chrome.WebDriver
find_option_by_text() (splin- method), 23
ter.driver.webdriver.edge.WebDriver method), get_alert() (splin-
41 ter.driver.webdriver.edge.WebDriver method),
find_option_by_text() (splin- 41
ter.driver.webdriver.firefox.WebDriver method), get_alert() (splin-
32 ter.driver.webdriver.firefox.WebDriver method),
find_option_by_text() (splin- 32
ter.driver.zopetestbrowser.ZopeTestBrowser get_alert() (splin-
method), 49 ter.driver.zopetestbrowser.ZopeTestBrowser
find_option_by_value() (splin- method), 50
ter.driver.djangoclient.DjangoClient method), get_iframe() (splin-
54 ter.driver.djangoclient.DjangoClient method),
find_option_by_value() (splin- 54
ter.driver.DriverAPI method), 65 get_iframe() (splinter.driver.DriverAPI method), 66
find_option_by_value() (splin- get_iframe() (splinter.driver.flaskclient.FlaskClient
ter.driver.flaskclient.FlaskClient method), method), 59
59 get_iframe() (splin-
find_option_by_value() (splin- ter.driver.webdriver.chrome.WebDriver
ter.driver.webdriver.chrome.WebDriver method), 23
method), 23 get_iframe() (splin-
find_option_by_value() (splin- ter.driver.webdriver.edge.WebDriver method),
ter.driver.webdriver.edge.WebDriver method), 41
41 get_iframe() (splin-
find_option_by_value() (splin- ter.driver.webdriver.firefox.WebDriver method),
ter.driver.webdriver.firefox.WebDriver method), 32
32 get_iframe() (splin-
find_option_by_value() (splin- ter.driver.zopetestbrowser.ZopeTestBrowser
ter.driver.zopetestbrowser.ZopeTestBrowser method), 50
method), 50
first (splinter.element_list.ElementList attribute), 73 H
FlaskClient (class in splinter.driver.flaskclient), 57 has_class() (splinter.driver.ElementAPI method), 71
forward() (splinter.driver.djangoclient.DjangoClient html (splinter.driver.djangoclient.DjangoClient at-
method), 54 tribute), 54
forward() (splinter.driver.DriverAPI method), 65 html (splinter.driver.DriverAPI attribute), 66
forward() (splinter.driver.flaskclient.FlaskClient html (splinter.driver.flaskclient.FlaskClient attribute),
method), 59 59
forward() (splinter.driver.webdriver.chrome.WebDriver html (splinter.driver.webdriver.chrome.WebDriver at-
method), 23 tribute), 23
forward() (splinter.driver.webdriver.edge.WebDriver html (splinter.driver.webdriver.edge.WebDriver at-
method), 41 tribute), 41
forward() (splinter.driver.webdriver.firefox.WebDriver
96 Index
splinter Documentation, Release 0.18.1
Index 97
splinter Documentation, Release 0.18.1
method), 25 ter.driver.webdriver.chrome.WebDriver
is_element_present_by_css() (splin- method), 25
ter.driver.webdriver.edge.WebDriver method), is_element_present_by_value() (splin-
43 ter.driver.webdriver.edge.WebDriver method),
is_element_present_by_css() (splin- 44
ter.driver.webdriver.firefox.WebDriver method), is_element_present_by_value() (splin-
34 ter.driver.webdriver.firefox.WebDriver method),
is_element_present_by_id() (splin- 34
ter.driver.DriverAPI method), 67 is_element_present_by_xpath() (splin-
is_element_present_by_id() (splin- ter.driver.DriverAPI method), 68
ter.driver.webdriver.chrome.WebDriver is_element_present_by_xpath() (splin-
method), 25 ter.driver.webdriver.chrome.WebDriver
is_element_present_by_id() (splin- method), 26
ter.driver.webdriver.edge.WebDriver method), is_element_present_by_xpath() (splin-
43 ter.driver.webdriver.edge.WebDriver method),
is_element_present_by_id() (splin- 44
ter.driver.webdriver.firefox.WebDriver method), is_element_present_by_xpath() (splin-
34 ter.driver.webdriver.firefox.WebDriver method),
is_element_present_by_name() (splin- 35
ter.driver.DriverAPI method), 68 is_empty() (splinter.element_list.ElementList
is_element_present_by_name() (splin- method), 73
ter.driver.webdriver.chrome.WebDriver is_success() (splin-
method), 25 ter.request_handler.status_code.StatusCode
is_element_present_by_name() (splin- method), 74
ter.driver.webdriver.edge.WebDriver method), is_text_present() (splin-
43 ter.driver.djangoclient.DjangoClient method),
is_element_present_by_name() (splin- 55
ter.driver.webdriver.firefox.WebDriver method), is_text_present() (splinter.driver.DriverAPI
34 method), 69
is_element_present_by_tag() (splin- is_text_present() (splin-
ter.driver.DriverAPI method), 68 ter.driver.flaskclient.FlaskClient method),
is_element_present_by_tag() (splin- 59
ter.driver.webdriver.chrome.WebDriver is_text_present() (splin-
method), 25 ter.driver.webdriver.chrome.WebDriver
is_element_present_by_tag() (splin- method), 26
ter.driver.webdriver.edge.WebDriver method), is_text_present() (splin-
44 ter.driver.webdriver.edge.WebDriver method),
is_element_present_by_tag() (splin- 44
ter.driver.webdriver.firefox.WebDriver method), is_text_present() (splin-
34 ter.driver.webdriver.firefox.WebDriver method),
is_element_present_by_text() (splin- 35
ter.driver.DriverAPI method), 68 is_text_present() (splin-
is_element_present_by_text() (splin- ter.driver.zopetestbrowser.ZopeTestBrowser
ter.driver.webdriver.chrome.WebDriver method), 50
method), 25
is_element_present_by_text() (splin- L
ter.driver.webdriver.edge.WebDriver method), last (splinter.element_list.ElementList attribute), 73
44
is_element_present_by_text() (splin- M
ter.driver.webdriver.firefox.WebDriver method), mouse_out() (splinter.driver.ElementAPI method), 71
34 mouse_over() (splinter.driver.ElementAPI method),
is_element_present_by_value() (splin- 71
ter.driver.DriverAPI method), 68
is_element_present_by_value() (splin-
98 Index
splinter Documentation, Release 0.18.1
N screenshot() (splinter.driver.flaskclient.FlaskClient
new_tab() (splinter.driver.djangoclient.DjangoClient method), 60
method), 55 screenshot() (splin-
new_tab() (splinter.driver.DriverAPI method), 69 ter.driver.webdriver.chrome.WebDriver
new_tab() (splinter.driver.flaskclient.FlaskClient method), 26
method), 60 screenshot() (splin-
new_tab() (splinter.driver.webdriver.chrome.WebDriver ter.driver.webdriver.edge.WebDriver method),
method), 26 45
new_tab() (splinter.driver.webdriver.edge.WebDriver screenshot() (splin-
method), 44 ter.driver.webdriver.firefox.WebDriver method),
new_tab() (splinter.driver.webdriver.firefox.WebDriver 35
method), 35 screenshot() (splin-
new_tab() (splinter.driver.zopetestbrowser.ZopeTestBrowser ter.driver.zopetestbrowser.ZopeTestBrowser
method), 50 method), 51
select() (splinter.driver.djangoclient.DjangoClient
Q method), 55
quit() (splinter.driver.djangoclient.DjangoClient select() (splinter.driver.DriverAPI method), 69
method), 55 select() (splinter.driver.ElementAPI method), 71
quit() (splinter.driver.DriverAPI method), 69 select() (splinter.driver.flaskclient.FlaskClient
quit() (splinter.driver.flaskclient.FlaskClient method), method), 60
60 select() (splinter.driver.webdriver.chrome.WebDriver
quit() (splinter.driver.webdriver.chrome.WebDriver method), 26
method), 26 select() (splinter.driver.webdriver.edge.WebDriver
quit() (splinter.driver.webdriver.edge.WebDriver method), 45
method), 45 select() (splinter.driver.webdriver.firefox.WebDriver
quit() (splinter.driver.webdriver.firefox.WebDriver method), 35
method), 35 select() (splinter.driver.zopetestbrowser.ZopeTestBrowser
quit() (splinter.driver.zopetestbrowser.ZopeTestBrowser method), 51
method), 50 shadow_root (splinter.driver.ElementAPI attribute),
71
R splinter.browser (module), 63
reason (splinter.request_handler.status_code.StatusCode splinter.cookie_manager (module), 72
attribute), 74 splinter.driver (module), 63
reload() (splinter.driver.djangoclient.DjangoClient splinter.driver.djangoclient (module), 52
method), 55 splinter.driver.flaskclient (module), 56
reload() (splinter.driver.DriverAPI method), 69 splinter.driver.zopetestbrowser (module),
reload() (splinter.driver.flaskclient.FlaskClient 47
method), 60 splinter.element_list (module), 73
reload() (splinter.driver.webdriver.chrome.WebDriver splinter.exceptions (module), 74
method), 26 splinter.request_handler.status_code
reload() (splinter.driver.webdriver.edge.WebDriver (module), 74
method), 45 StatusCode (class in splin-
reload() (splinter.driver.webdriver.firefox.WebDriver ter.request_handler.status_code), 73
method), 35
T
reload() (splinter.driver.zopetestbrowser.ZopeTestBrowser
method), 51 text (splinter.driver.ElementAPI attribute), 71
title (splinter.driver.djangoclient.DjangoClient at-
S tribute), 56
screenshot() (splin- title (splinter.driver.DriverAPI attribute), 69
ter.driver.djangoclient.DjangoClient method), title (splinter.driver.flaskclient.FlaskClient attribute),
55 60
screenshot() (splinter.driver.DriverAPI method), 69 title (splinter.driver.webdriver.chrome.WebDriver at-
screenshot() (splinter.driver.ElementAPI method), tribute), 27
71
Index 99
splinter Documentation, Release 0.18.1
V
value (splinter.driver.ElementAPI attribute), 72
visible (splinter.driver.ElementAPI attribute), 72
visit() (splinter.driver.djangoclient.DjangoClient
method), 56
100 Index