Features
< Back to Blog Overview

Webdriver Backed Selenium: use RC and WebDriver together

2012-05-14
  • Share on Facebook
  • Share on Twitter
  • Share on LinkedIn
  • Share on HackerNews

Today we have added full support for Webdriver-backed Selenium, which allows you to use the two API's together in a single test.


By using this feature, it will be easier for you to migrate your existing Selenium RC tests to the new WebDriver format. Here's a list of reasons on why you should consider start using WebDriver:

  • Better and more consistent API
  • Improved emulation of user interactions. WebDriver uses native events in order to interact with a web page, where possible.
  • Support by the major browser vendors. Chrome, FireFox and Opera are all active contributors in WebDriver’s development
  • Faster, less error-prone tests

Even though not all RC commands are supported, you can now run most of your RC tests on a WebDriver instance inside our grid. An example of using the two API's together in Ruby would be:


#!/usr/bin/env ruby

require "rubygems"
require 'testingbot' 
gem "selenium-client"
gem "selenium-webdriver"
require "selenium-webdriver" 
require "selenium/client"

selenium = Selenium::Client::Driver.new :host    => "hub.testingbot.com",
                                        :port    => 4444,
                                        :url     => "https://www.facebook.com",
                                        :browser => "*webdriver"
                                        
caps = {
  :browserName => "iexplore",
  :platform => "WINDOWS"
}
urlhub = "http://API_KEY:API_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
selenium.start :driver => @webdriver
puts @webdriver.title == selenium.title # WebDriver and RC together
selenium.open "/" # RC
@webdriver.quit # WebDriver

This test will show up in our member area with screenshots/video and a list of steps from both RC and WebDriver.

TestingBot Logo

Sign up for a Free Trial

Start testing your apps with TestingBot.

No credit card required.

Other Articles

Test TV - Live video stream of your tests running in the Cloud

Today we released a new feature in our TestingBot member area called Test TV.

Read more
Selenium Tunnel - Run Selenium tests on your staging environment.

Today we are proud to release our new Selenium Tunnel, which will enable you to run Selenium tests on your local computer and network infrastru...

Read more
iPhone and iPad Selenium Testing with Webdriver

Since our last post announcing Mac OS X Selenium support, we now have added iPhone and iPad to the mix.

Read more