Geb vs. Sahi vs. Selenium-Webdriver

Jan 8, 2014

gebAs an addendum to my original post comparing Selenium and Sahi, I offer the same test written in Geb.

Sidebar: I took a bit of flack for the original article, mainly people complaining that my comparison wasn't an apples to apples comparison. Their argument was that because they share a more similar architecture, a more fair comparison would be to compare Sahi to Selenium RC. Of course this argument is complete rubbish. My comparison was (and is) merely a look into the raw code of each tool. But even if it wasn't, Sahi and Selenium both aim to provide the same function: web application automation. Comparing these two tools is completely valid... though I do profess to enjoy the modicum of hyperbole. That all being said, I will paraphrase Mike Watt and say: "if you don't like it, go out and start your own blog!"

Anyway, I'll throw Geb's hat in the same ring with one disclaimer: Geb runs on top of Webdriver... WORLD BEWARE. Please feel free to breath into a paper bag or the something...

Now, without further ado, I give you [gasp] the Google Translate test, written in raw Geb (no developers were hurt during the coding of this test (unless you equate drinking most of a bottle of wine to being "hurt" (which I do not (because I live in Wisconsin)))). Enjoy responsibly!

import geb.Browser

Browser.drive {
    go('http://translate.google.com/')

    $('div#gt-sl-gms').click()
    $('div.goog-menuitem-content', text:'Norwegian').click()
    $('textarea#source') << 'ost'

    waitFor {
        $('span#result\_box').text() == 'cheese'
    }

    quit()
}

Download the working code from GitHub...

Note: this code, like the original Sahi and Selenium code, is "in the raw", as it were. I.e. no page objects or custom methods to help readability/maintainability/*.ility.