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.
Open the Selenium IDE.
Navigate to http://book.theautomatedtester.co.uk/chapter4.
Create a step to verify that the select with the ID
selecttype
has four options in it.Run your script. It should look similar to the next screenshot.
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...