Imagine that you are testing a web application that requires you to type today's date into a textbox. Let's see how one would do that.
Open the Selenium IDE.
Navigate to http://book.theautomatedtester.co.uk/chapter4.
Use the
type
command on the locatordateInput
to put in the result of the following JavaScript:javascript{ Date() }
.Run your script. It should look similar to the next screenshot.
As you can see from the screenshot, the command we used has typed something into the textbox. In this case, we just had one javascript
statement, which was javascript{Date()}
, and that was placed into the input box.
Let's now have a look at using multiple statements to calculate the current hour of the day.