Splinter Python Acceptance Testing

Splinter Python Acceptance Testing For Web Applications

Splinter python acceptance testing for web applications is one of my favorite tools when I am testing my web applications. Many developers have used and recommend the tool. This tool isn’t hard to use and it will even be more fun to use if you know a little bit of python programming. As I have mentioned above, a lot of developers are already using it. These developers are not better than you but I think they know something that you don’t. It is that thing you are going to learn on this page.

You will understand splinter python acceptance testing for web applications better is I explain the details one after the other.


What Is Splinter Python Acceptance Testing For Web Applications

Splinter python acceptance testing for web applications is an automation tool. It is used to simplify the acceptance testing of a web application. As a web app developer, you would love to have a tool that can help you test some functionalities of your web app. That is where python splinter comes in. It is not actually a tool per se, just some lines of code written in python programming. Below is a simple example of it.


from splinter.browser import Browser

browser = Browser(‘chrome’)


browser.fill(‘q’, ‘splinter – python acceptance testing for web applications’)


if browser.is_text_present(‘splinter.cobrateam.info’):

print “Yes, the official website was found!”


print “No, it wasn’t found… We need to improve our SEO techniques”


Splinter Python Acceptance Testing For Web Applications

How To Use Splinter Python Acceptance Testing For Web Applications

Simple installation

The tool requires that you install a version of python above version 2.7. The rest is simple if you have such installed. Just initiate the pip installer with this code:

$ pip install splinter

A note of warning though. If you are using a proxy, you will need to replicate that same proxy settings on python before the installer will work. And about web drivers – Python splinter has all the web drivers you will ever need.

That is what makes it different and widely accepted than the other tools used in web applications testing.

How to set up proxy settings on python

You must set the proxy setting in python when you use a proxy server on your computer. Use the following code to set a variable in the python environment:

set http_proxy=http://user:some%20long%[email protected]:80

READ: How Java Program, Compiler and Interpreter Works

Python Splinter Vs Selenium

There are few factors that made many web app developers dump selenium for splinter. After going through a lot of testing a research on python splinter vs selenium, it all boils down to these thing:


Selenium looks slow compared to splinter. This is because selenium lacks some drivers that are easily available with splinter. As an example, there is a driver you will use when you need to do something that does not require JavaScript. This driver isn’t present in selenium.

General API

Splinter is a general API for all web browsers. And upon that it still makes it easy to locate elements in each browser that you choose. Such flair is not available in selenium.

Python Splinter Find_By_Xpath

Python splinter find_by_xpath is used to find something from using the _xpath function. There are many other functions which you can use to locate what you want.

There are:





browser.find_by_text(‘Hello World!’)



These functions are easy to use but if you are having a problem using them, use this tip. Take one of the functions and implement it in your code. See out it behaves and test the next one. That ends the splinter python acceptance testing for web applications. You can get in touch if you want to know or post a question on stackoverflow.

Leave a Comment

Your email address will not be published. Required fields are marked *