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 py3-pip

Then fetch Selenium and install the Python module:

doas pip3.4 install selenium
ftp $url


The selenium server listens on port 4444 and an instance of phantomjs on 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 January 23, 2018