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 – using basic regular expressions to check the date


In this section, we are going to check that the date on the page follows the pattern of three letters for the day, two numbers for the day of the month, three letters for the month, and four numbers for the year. The regular expression for this would be \w{3} \d{2} \w{3} \d{4}. The \w will look for word characters and \d will look for digit characters and the figure in between {} tells the expression how many times it should expect each type.

Now let's do this in Selenium

  1. Open up the Selenium IDE.

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

  3. Note verifyText in the div with the ID centerdiv with the Value field populated regexp:\w{3} \d{2} \w{3} \d{4}.

  4. Run the test and it should look similar to the next screenshot.

What just happened?

We just had a look at creating a test with a regular expression. This is quite useful for checking that there is a date on the page and that it conforms to a certain pattern. This is...