Here's a special April Fool's Day trick for Behat: swap out your Selenium Driver with Phantomjs.

Materials that you will need:

  • Phantomjs
# Somewhere in your provisioning script.
wget -O - | tar xj -C /tmp
cp /tmp/phantom*/bin/phantomjs /opt
  • A browser
# Somewhere in that same provisioning script.
sudo apt-get update -y && sudo apt-get install -q -y iceweasel

Kick that driver into gear:

# Somewhere in that same provisioning script.
/opt/phantomjs --webdriver=8643 &> /dev/null &

Now here is the tricky part, in your behat.yml tell behat to use the Selenium Driver at the same point where you have phantomjs listening:

# Your behat.yml
      goutte: ~
        wd_host: ""

Behat will get the last laugh, though: phantomjs is far more efficient than Selenium.

What do you think?

I'd love to hear from you. Contact Michelle.