Jump to ratings and reviews
Rate this book

Selenium Testing Tools Cookbook

Rate this book
Over 90 recipes to help you build and run automated tests for your web applications with Selenium WebDriver This book is intended for software quality assurance/testing professionals, software project managers, or software developers with prior experience in using Selenium and Java to test web-based applications. This books also provides examples for C#, Python and Ruby users. This book is an incremental guide that will help you learn and use the advanced features of the Selenium toolset including the WebDriver API in various situations to build a reliable test automation. You start off by setting up the test development environment and gain tips on the advanced locater strategy and the effective use of the Selenium WebDriver API. After that, the use of design patterns such as data - driven tests and PageFactory are demonstrated. You will then be familiarised with extending Selenium WebDriver API by implementing custom tasks and setting up your own distributed environment to run tests in parallel for cross-browser testing. Finally, we give you some tips on integrating Selenium WebDriver with other popular tools and testing mobile applications. By the end of this book, you will have learned enough to solve complex testing issues on your own. This recipe-based guide covers real-life scenarios of testing your web apps with Selenium. Each recipe begins with a short introduction and key concepts along with illustrated examples of use cases, and ends with detailed but informative descriptions of the inner workings of the example.

326 pages, Paperback

First published November 27, 2012

32 people are currently reading
214 people want to read

About the author

Unmesh Gundecha

6 books1 follower

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
25 (31%)
4 stars
28 (35%)
3 stars
19 (24%)
2 stars
5 (6%)
1 star
2 (2%)
Displaying 1 - 6 of 6 reviews
Profile Image for Michael Larsen.
21 reviews11 followers
January 21, 2013
As the experience level with Selenium and other open source automation tools grows, naturally there will also develop more questions. How would I effectively access elements? What's a good way to compartmentalize tests? Howe can I make my tests extensible? What's the best way to parallelize tests? What if my project doesn't use a standard approach like so many others? What if I'm not on Linux, or don't use Java?

The idea and benefit of a "Cookbook" approach is that it allows developers and testers to look at the aspects that they need at that time, and see how they work in example formats, and then see how they relate to other topics. Packt has decided to take this approach with Selenium by publishing the Selenium Testing Tools Cookbook. In it, author Unmesh Gundecha has broken down thirteen areas of interest (eleven in the book itself, plus two additional areas as bonus download sections), and presents small sections and ideas to allow the developer or tester to leverage the ability to create tests, use the Selenium API, and test applications such as browsers and mobile applications. The book demonstrates examples primarily in Java, but several are provided that use C#, Python and Ruby.

For the tl;dr crowd, if you have never used Selenium before, this should not be the book to start your exploration. I would suggest reading David Burns "Selenium 2 Testing Tools Beginner's Guide" or Alan Richardson's "Selenium Simplified" first. David's book is also a Packt Publishing title, and uses many of the same documentation standards, so it would feel very natural looking at section's of David's book, and then coming back to try out more examples in Unmesh's Cookbook here.


As this is a Cookbook style title, I must give a disclaimer that I have not yet tried every single example in the book. For that matter, I haven't gone through even a minority of the examples, and that's OK. Cookbook's are not designed to be read from cover to cover, and neither is this one. It is expected, and intended, that the user pick an area that interested them, and explore that area. Different projects have different needs, and being able to skip around will help focus the reader's time on the areas that matter most to them at that given time.

Each chapter uses a similar structure, with an introduction to explain the tools and calls that will be used in that section. The given recipe is described and gives the reader an idea as to what can be done (along with sample code for each of the recipes, which can be downloaded from Packt's site if you prefer to see the projects in their entirety, and would rather not have to type out the examples from the book directly. Each item then goes through and describes what you will need to accomplish the project at hand (if you need tools like Firebug or Intellij IDEA, it tells you what you need and where to get them). The recipe concludes with a How it Works section, and in many cases, additional recipes that relate to the one you are working with.

The book starts out with locating elements, and the different ways in which that can be accomplished (CSS, XPath, text values, jQuery, locating table rows and cells, etc.).

Next the Selenium API is explored and the various methods available to examine and determine what you are looking at (text, attributes, CSS values, interacting with the mouse and keyboard, using JavaScript, capturing screenshots, drop downs and menu items, even going in and changing values in the Windows Registry if desired).

Chapters Three and Four will be important to testers especially, since these chapters deal with test flow and ways to create data driven tests. Topics such as waiting for elements, handling pop-ups, determining if elements are the correct state, working with JavaScript alerts, handling frames and iFRAME's, plus using a variety of frameworks to interact with tests and set up data driven tests in these frameworks are explored, with examples for Java, win32, Ruby and Python.

Chapter Five talks about the Page Object model and how to use it when developing your tests in the languages covered in the book (Java especially, but examples also show how to use .NET, Python and Ruby).

Chapter Six gets into some examples of how to extend selenium and shows some in depth examples using Java (examples include making an extension class for web tables, jQueryUI Tab widget, creating an object map for Selenium tests, capturing screenshots and comparing images).

Chapter Seven Shows how to perform mobile testing using Selenium, and some of the tools and ways to automate tests on iPhone an Android devices using RemoteWebDriver and other tools, such as the iWebDriver App to be used on a simulator or real device, or AndroidDriver on an android Simulator or device)

Chapter Eight demonstrates some examples of how to get a handle on the Performance aspects of your sites or applications. Using timers, accessing and using BrowserMob proxy, and integrating with dynaTrace or HttpWatch are likewise covered. For the Ruby users among us, an example with Watir-WebDriver-Performance is demonstrated.

Chapter Nine covers HTML5 and some of the unique tools provided with HTML5, JavaScript and CSS3, such as video widgets, canvas and web storage, and how to interact with those elements.

Chapter Ten shows a number of ways in which a user could Record a Video of a Test (not record and playback of a test, actually recording an instance of the test being run as a video file, so it can be reviewed later. Tools such as the Monte Media Library (Java), Microsoft Expression Encoder (.NET) and Castro (Python) are demonstrated.

Chapter Eleven discusses Behavior Driven Development (BDD). There are several different books that go into this topic at length, so for more on how this works and how to leverage that aspect, you will definitely want to read more than this single chapter. Still, if you are interested in how BDD can be performed in different environments, this will be of interest. The goal of TDD is meant to be a way to write test cases in a more natural language that those who do not program can both read and, in some cases, create themselves. Ruby users will find examples using Cucumber and Cabybara. Java users will see examples using Cucumber-JVM and JBehave. .NET uses will see examples using SpecFlow.NET.

Two additional chapters, Integration with Other Tools and Distributed Testing with Selenium Grid are not included with the book itself, but can be downloaded from the Packt site. these deal with integrating with tools like Eclipse and IntelliJ IDEA, as well as using Ant and Maven for Continuous Integration, as well as parallelization of tests using Selenium Grid.

Bottom Line:

We now have a number of titles to help users get into the world of Selenium and SeleniumWebDrier. Each of these titles, by necessity, can only go so deep and with so many examples. For many, that would be fine. For those who want to know "what's next" or "where could I take these ideas and expand on them" or even "can you give me some ideas as to where I might use the variety of options?", then Selenium Testing Tools Cookbook may be a great next step to explore. One thing's for sure, there's plenty in this book to keep the Selenium enthusiast busy for quite some time.Unmesh Gundecha
36 reviews1 follower
July 11, 2017
The only Selenium book I've found so far that doesn't shy away from covering advanced topics such as distributed parallel testing and the Page Object design pattern. Kudos for the completeness.
Profile Image for Jeanne Boyarsky.
Author 28 books76 followers
May 26, 2014
“Selenium Testing Tools Cookbook” covers a lot of ground. I've written some Selenium tests and still learned new things in chapter 1.

It's not meant to be an introduction book so you should have written a test before. I like the depth on foundations though. From browser plugins to advanced selectors, there is a lot to see. I particularly liked the CSS selector syntax summary.

It was good to see JSExecutor covered – I wasted a good amount of time with this on a problem in the past. I liked seeing the page object pattern (which looks like a DSL) and the Actions framework. I like the example of a parameterized test case in chapter 4. I would have liked to see it broken up so not a ton of code in a row though.

There are warnings as needed when showing a feature that you might not want to use. Or when showing a feature that is only available in some cases. For example, the HtmlUnitDriver doesn't support taking screenshots.

I could write a review without mentioning the JDBC example has a resource leak. It may be “just” test code, but I still remember the time (a decade ago) that I locked out the test database server because my integration test had a resource leak in it.

I was skeptical when the book said it covered Java, C#, Python and Ruby. But it really does. This book is going to be a helpful reference to have around when I'm writing future tests.
Profile Image for Elias Nogueira.
31 reviews12 followers
September 8, 2013
There's some good recipes, but not so well explanation about what they do in deep (you need a basic WebDriver knowledge to read this book in some recipe, in my opinion).

There's a recipe which refers the use of a object repository, and it's is well know of old automation tools couldn't map element in a effective way.

There's some recipes not related to WebDriver, like comparing two screenshots or few related like create an element to handle jQuery Tabs (!), Performance testing with WebDriver (!), Testing HTML5 Web Applications that is a lot of workarrounds using javascript

So the book is ok, there's a good introduction but, in my opinion, the authors try to turn WebDriver in the same way as a commercial tool (with a lot of "custom features" that not always will help).
And they missed one of most important subject in WebDriver nowadays: RemoteDriver and Grid
Profile Image for Stefan Teixeira.
27 reviews4 followers
July 2, 2015
This is the best book about Selenium WebDriver. The recipes cover all important topics, but be sure to download the two bonus chapters, that makes the book truly complete.
Displaying 1 - 6 of 6 reviews

Can't find what you're looking for?

Get help and learn more about the design.