Tuesday, May 12th, 2009

Selenium WebDriver Re-introduced

Category: Testing

<p>Simon Stewart is a smart man, and nice chap, that I had the fortune to meet quite awhile back at Google London. He is an active Selenium hacker, and has re-introduced Web Driver that lets you write this Java code:

  1. // Create an instance of WebDriver backed by Firefox
  2. WebDriver driver = new FirefoxDriver();
  3.  
  4. // Now go to the Google home page
  5. driver.get("http://www.google.com");
  6.  
  7. // Find the search box, and (ummm...) search for something
  8. WebElement searchBox = driver.findElement(By.name("q"));
  9. searchBox.sendKeys("selenium");
  10. searchBox.submit();
  11.  
  12. // And now display the title of the page
  13. System.out.println("Title: " + driver.getTitle());

WebDriver has a simple API designed to be easy to work with and can drive both real browsers, for testing javascript heavy applications, and a pure ‘in memory’ solution for faster testing of simpler applications.

Interested? Check out the getting started guide where you do a Google Suggest test, and watch Simon from waaaay back in 2007:

Related Content:

Posted by Dion Almaer at 6:54 am
2 Comments

+++--
3.5 rating from 20 votes

2 Comments »

Comments feed TrackBack URI

And for the .Net guys out there, there exists a zillion similar solutions (which I know about) for .Net. Among one of the more prominently known ones are WatiN, which also carries the bonus of being maintained by Jeroen which is very nice when it comes to listening to feature requests, wants, needs and such.

Comment by ThomasHansen — May 12, 2009

Selenium is a favorite, thanks for the info.

Comment by taheal123 — August 24, 2009

Leave a comment

You must be logged in to post a comment.