Book Image

Selenium 1.0 Testing Tools: Beginner's Guide

By : David Burns
Book Image

Selenium 1.0 Testing Tools: Beginner's Guide

By: David Burns

Overview of this book

<p>Selenium is a suite of tools to automate web application testing across many platforms. A strong understanding of using Selenium will get you developing tests to ensure the quality of your applications.</p> <p>This book helps you understand and use Selenium to create tests and make sure that what your user expects to do can be done. It will guide you to successfully implement Selenium tests to ensure the quality of your applications.</p> <p>The Selenium Testing Tools Beginner’s guide shows developers and testers how to create automated tests using a browser. You'll be able to create tests using Selenium IDE, Selenium Remote Control and Selenium 2 as well. A chapter is completely dedicated to Selenium 2. We will then see how our tests use element locators such as css, xpath, DOM to find elements on the page.</p> <p>Once all the tests have been created we will have a look at how we can speed up the execution of our tests using Selenium Grid.</p>
Table of Contents (18 chapters)
Selenium 1.0 Testing Tools Beginner's Guide
Credits
About the Author
About the Reviewers
Preface
Index

Time for action – verifying a JavaScript evaluation with browserbot


Imagine that you need to check whether a select has a certain amount of options in it. This could be down to the fact that we don't know what order they are going to be in, so we cannot utilize a regular expression. Let's see how we can do this.

  1. Open the Selenium IDE.

  2. Navigate to http://book.theautomatedtester.co.uk/chapter4.

  3. Create a step to verify that the select with the ID selecttype has four options in it.

  4. Run your script. It should look similar to the next screenshot.

What just happened?

We have just seen how to verify that something on the page meets certain criteria. In this case, we wanted to check that the select with the ID selecttype had four options in it. This means our tests do not have to rely on Selenium commands. We can make small ad hoc calls in javascript to verify elements on the page.

There are times that you may want to do something similar but the options are loaded with AJAX. When that happens, we can...