Today we have added PhantomJS to our Linux VMs on our Selenium Grid. You can now run your WebDriver tests on PhantomJS + Ubuntu.
PhantomJS is a headless WebKit solution which is very fast, it does not suffer from slow browser startup times or other issues you might encounter with browsers.
Together with Ivan De Marino’s GhostDriver, we can now run Selenium WebDriver tests with PhantomJS. An example of how to run a simple test with Ruby and PhantomJS on our grid:
caps = {
:browserName => "phantomjs",
:platform => "LINUX"
}
urlhub = "http://key:secret@hub.testingbot.com:4444/wd/hub"
client = Selenium::WebDriver::Remote::Http::Default.new
client.timeout = 120
@webdriver = Selenium::WebDriver.for :remote, :url => urlhub, :desired_capabilities => caps, :http_client => client
@webdriver.navigate.to "http://www.google.com/"
puts @webdriver.title
@webdriver.save_screenshot("./screenshot.png")
@webdriver.quit
The example above will open the homepage of Google, print the title of the homepage and save a screenshot of the page on your harddisk. As PhantomJS and GhostDriver will be improved and updated in the future, we will keep on updating these on our Linux VMs.
Together with Ubuntu, PhantomJS is very fast: PhantomJS + GhostDriver Ubuntu on our grid: