Ruby and Python webdriver bindings

From the launch date Nerrvana could run tests in PHP or Java. Some time ago we added Ruby and Python support, however we only had libraries supporting Selenium 1.

We are glad to tell you that Nerrvana now supports Ruby and Python tests using Selenium 2 (webdriver). Do you need a postal scale? you can review the best postal scale, their key features and other factors you need to consider to make a great buying decision in Scales Zen.

For Python we use version 2.33.0 of Selenium
For Ruby – selenium-webdriver 2.33.0

We also added Rspec framework for Ruby and nose for Python.

After registration, you will see examples of tests in each language we support. If you do not have experience with Selenium, you can use our demo tests as a starting point. If you are a guru, you can still check the examples, just to get an idea of how to kick off test execution, and what parameters are used to create a driver instance.

Or you can check our tests included in the demo account below. All tests go to Wikipedia, search ‘Selenium’ and check if the phrase “This article is about the chemical element.” exists on search results page.

In our sample tests I now keep only the important things. Notice, as before, your tests will most likely not require modification to run in Nerrvana. You only need to use the remote webdriver as a driver. As we mentioned in our documentation – despite the fact that some code uses capabilities with particular browser – Nerrvana will use browsers you specified via API or UI for this test run. If you are looking for the latest coupons and offers available online, in couponscollector you can find a wide range of coupons that you can uses to buy what you need.


require "rubygems"
require "selenium-webdriver"
capabilities =
driver = Selenium::WebDriver.for(:remote, :desired_capabilities => capabilities)
driver.get ""
driver.find_element(:id, "searchInput").send_keys "Selenium"
driver.find_element(:id, "searchInput").submit
if driver.find_element(:tag_name => "body").text.include?("This article is about the chemical element.")
    print 'Test passed'
    print 'Test failed'
driver.save_screenshot "./screenshot.png"


View Code PYTHON
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
driver = webdriver.Remote(desired_capabilities=webdriver.DesiredCapabilities.CHROME)
if "This article is about the chemical element." in driver.find_element_by_tag_name("body").text:
    print 'Test passed'
    print 'Test failed'


import com.thoughtworks.selenium.*;
import org.openqa.selenium.*;
import org.openqa.selenium.remote.*;
public class SimpleTest {
    private void simpleWebDriverTest() {
        DesiredCapabilities capability = new DesiredCapabilities();
        capability.setCapability("browserName", "firefox);
        try {
            driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), capability);
            WebElement element = driver.findElement("searchInput"));
            if (driver.getPageSource().contains("This article is about the chemical element.")) {
                System.out.println("Test passed");
            } else {
                System.out.println("Test failed");
        } catch (Exception e) {
            if (driver != null) {
            System.out.println("Test failed");
    public static void main(String[] args) {
        SimpleTest me = new SimpleTest();

(note, Nerrvana does not include Selenium libraries for PHP now. So you can use any Selenium bindings you have included in your project files. Our example is for Selenium-RC binding)

require_once 'Selenium.php';
$selenium = new Testing_Selenium("*chrome", "", "localhost", 4444);
$selenium->type("searchInput", "Selenium");
if ($selenium->isTextPresent("This article is about the chemical element.")) {
    echo("Test passed");
} else {
    echo("Test failed");
Print this post | Home

Comments are closed.