Hi

in a previous project, I also wanted to check all select menus on a page.
My solution was to define the content of each menu in a file (foo.menu,
bar.menu, ...), and store all these menu definitions in the same directory
with a small webtest.

Each .menu file is a list of the option values, and the first line of the .menu
file is an xpath that select the menu on the page.
In your case, the file would look like:
//[EMAIL PROTECTED]'searchLegs[0].originPoint']
none
AKL
CHC
WLG
...

The webtest called the attached groovy script.

The groovy script then verify that the number of elements in the html page is the same as the number of elements in the menu definition file, then verify
that there is a menu entry for every line in the file.

Attachment: verifyPullDowns.groovy
Description: Binary data



I assume you won't be able to use the script as is, but it could be a basis to
build on!

Best
        dna


On 7 janv. 07, at 12:51, John and Pip wrote:

Hi All,

What is the recommended way in WebTest to check the content of a
select list on a page?

As an example I have the list appended below (you can see it at
https://flightbookings.airnewzealand.co.nz/isbook_en_NZ/book/ initSearchForFlights.do)
and I need to check that the correct elements appear.

It will always default to the same selected value so checking for the
literal HTML below would work, but I can not figure out how to do this
- it seems a bit beefy for verifyText although I can make it work for
the first line but am not sure it can handle the full list? I am
having problems with having to escape characters.

[...]

I realise I could use verifySelectField to check the currently
selected option, and I could use verifyXPath probably to count the
number of options, but neither of those is what I want.

I could also perhaps use verifyElementText but I've not managed to get
even a single line validated with this.

I would appreciate any advise.

regards,
       John

<select name="searchLegs[0].originPoint"
onchange="the_fare_finder.changeInPoints();" style="width:140px;"
class="dps"><option value="">select a city</option>
<option value="none">----------------</option>
<option value="AKL">Auckland</option>

<option value="CHC">Christchurch</option>
<option value="WLG">Wellington</option>
<option value="none">----------------</option>

[...]

</select>
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest

--
Any technology distinguishable from magic is insufficiently advanced.

Reply via email to