Webdriver Backed Selenium: use RC and WebDriver together

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.

No Comments

Leave a Reply

Your email address will not be published. Required fields are marked *