To count the number of items within a drop down menu, use a WebParseDataBoundArray to extract the information from the source code of the application itself.

The WebParseDataBoundArray() function parses the response data for left and right boundaries and stores all strings between these boundaries as well as the number of strings found.

For example, from the HTML source code below, we can see that the dropdown menu contains 5 items/options, Volvo to Ford.

To get a count of these values include a WebParseDataBoundArray() function with a left boundary of “value=” in the Silk Performer script,

Two variables are defined within the function, sHead, which is an array of string variables that receive all strings defined within specified boundaries, and sFound, that receives the number of found strings, i.e. the number of strings which match the left boundary “value=”.

We include a Print statement which shows that the drop down menu has 5 options.

BDL Script

Result

Note, " ", has been included within the right boundary as this can optionally be assign a null value.