verifyAttribute help w/Selenium for AMO?

| 3 Comments

Earlier today, I tried to write a Selenium testcase to help ensure that bug 504188 never happens again; the bug was that advanced-search parameters in our AMO 5.0.7 candidate weren't getting set properly.

View source on the following page, and grep for "Linux" -- we want to verify that whole line, basically:

* option 2 is selected
* has "Linux" in its value

In the Selenium IDE, we're checking for:

verifyElementPresent, //div[@id='advanced-search']/fieldset[2]/div[3]/label[@for='pid'], Value="Linux"

But this isn't working -- verifyElementPresent is happy and returns success/true, because it finds the element, and doesn't care about the value in Value=; I *think* verifyAttribute is what we want, instead, but Raymond, Juan, and I tried that tonight without success.

Help is appreciated!

3 Comments

This :
1/ verifySelectedValue, id=pid, 2
2/ verifySelectedLabels, id=pid, Linux

works for me with Selenium IDE 1.0.2

Régis.

What you want is:

for HTML scripts:

verifySelected, pid, label=Linux

for Perl scripts:

$sel->selected_label_is("pid", "label=Linux");


I doubt you are interested to know that Linux has value=2. If you are interested to check this anyway, add:

for HTML scripts:

verifySelected, pid, value=2

for Perl scripts:

$sel->selected_label_is("pid", "value=2");


I hope you are using Perl scripts, because they are much more powerful than HTML scripts IMO. :)

Why not use "verifySelectedLabel, pid, Linux"? Or do you actually care about the order of choices? In which case you could add a second verification for "verifySelectedIndex, pid, 2",

As to the original check, you don't want label there, because that searches for <label for="pid"> not for the selected value. Label for pid has text()='Platform' and no value attribute.

To check for automatically selected element you could use "verifyElementPresent, //select[@id='pid']/option[@selected and ./text()='Linux'] but that only considers <option selected> in source which isn't the same as currently selected element if user has changed selection.

Leave a comment

About this Entry

This page contains a single entry by Stephen Donner published on July 14, 2009 8:20 PM.

Started writing testcases for SUMO (support.mozilla.com) was the previous entry in this blog.

MozWebQA (testing) volunteer resource page is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Pages

Powered by Movable Type 5.12