Fork me on GitHub

Speed Up Your Selenium Tests with PhantomJS
Ivan De Marino - Senior Software Engineer / Neustar, Inc.
Selenium Conference - April 2012

Who is Ivan De Marino?

Senior Engineer at Neustar

I lead the development for the Neustar Web Perfomance Management Agent

Contributor to PhantomJS

Worked on many parts and contributed things like Filesystem API and recently, REPL mode

Spend lots of my time

Only used Selenium for a few months

So, go easy on me ;-)

Neustar WPM Agent

My team is responsible for the "Super" Agent:

We are Hiring!!!

PhantomJS logo
via Wordle

PhantomJS: What's all the fuss about?

PhantomJS logo

fLeXibLe

PhantomJS is flexible

Every thing you need in 20 lines!


Prototype Boeing Phantom Ray [via Wikipedia]

PhantomJS aims at being fast

PhantomJS does have (some) drawbacks

How much do you value your time?
Busy Life, Bloor Street [via]

Time is usually interpreted as:

Time = Distance Speed

So what we need is
SPEED!
"... or less Distance!"
John Bower

How long does it take do a test?

test.coding.time = test.coding.write(platform.ease) test.result.time = test.exec(platform.speed, project.size) test.time 0 i test.coding.time + n test.result.time

Classic example: "Google Cheese!" Test

Test Hardware Specs

  • MacBook Pro late 2011
  • 2.2 GHz Intel Core i7
  • 8 GB 1333 MHz DDR3

We need to
reduce( test.result.time )

3~5s
is good for overnight tests,
but not so good for coding turnaround

GhostDriver
github/ghostdriver

What's GhostDriver?

GhostDriver vs. "Google Cheese!" Test?

Test Hardware Specs

  • MacBook Pro late 2011
  • 2.2 GHz Intel Core i7
  • 8 GB 1333 MHz DDR3

Demo
mvnexec.sh & mvnexec-server.sh

Timing when starting/stopping the Driver: 5 iterations / 100 iterations

Timing when in server mode: 5 iterations / 100 iterations

PhantomJS + GhostDriver: Pros & Cons

Pros

Cons

GhostDriver: Project Status

Thanks!
Questions?
github/detro/ghostdriver - github/ariya/phantomjs

Appendix: A bit of Architecture

/

#