Eric Radman : a Journal

Integration Testing with Selenium and PhantomJS

Writing integration tests for a web app is not very difficult to set up thanks to ghostdriver, which is built into phantomjs.


On OpenBSD add the following packages

doas pkg_add jre phantomjs python-3.4.1p1 py3-pip

Then fetch Selenium and install the Python module:

doas pip3.4 install selenium
ftp $url


The selenium server (port 4444) and an instance of phantomjs (port

8080) must be running first
java -jar selenium-server-standalone-2.42.2.jar &
phantomjs --webdriver=8080 --webdriver-selenium-grid-hub= &

Your First Test


from selenium import webdriver

browser = webdriver.PhantomJS(executable_path="/usr/local/bin/phantomjs")

assert "OpenBSD" in browser.title

For further reading see the Selenium Documentation.

Last updated on March 08, 2017