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
Open up the Selenium IDE.
Navigate to http://book.theautomatedtester.co.uk/chapter3.
Note
verifyText
in the div with the IDcenterdiv
with the Value field populatedregexp:\w{3} \d{2} \w{3} \d{4}
.Run the test and it should look similar to the next screenshot.