Bob
Bob

Reputation: 217

assertValue doesn't work on select boxes with the Selenium IDE Firefox plugin

I'm using Selenium IDE in Firefox to build test cases.

When I right-click on a select box and choose "Show All Available Commands," assertValue is always grayed out. With text boxes and option boxes, I can use assertValue to make sure that a specific value is set. Why is this functionality not available for select boxes? Or is there a trick needed to make Selenium IDE let me user assertValue on an HTML select box?

If you want a concrete example, try the following:

  1. Start a new Selenium IDE Test Case.
  2. Open http://www.google.com/advanced_search
  3. Near the bottom of the page, there is an HTML select box for "Language" which defaults to "Any Language." Right-Click on "Any Language" and go to "Show All Available Commands," and assertValue will be grayed out. Why can't I use assertValue on this select box?

Upvotes: 3

Views: 2405

Answers (3)

Alex Rashkov
Alex Rashkov

Reputation: 10015

Here is how I sorted that out, add manually new command in the IDE:

Command: assertSelectedValue
Target: id=countrySelect
Value: Switzerland

Upvotes: 2

farheen
farheen

Reputation: 1906

You cannot use assertValue on a dropdown select because select tag has only options, not the value attribute.

You can click on the languages dropdown and select from the options.

Below is the code for selecting a value from the dropdown list in IDE for the mentioned site.

open /advanced_search
click //option[@value='lang_el']
select lr label=French

Upvotes: 0

borrible
borrible

Reputation: 17376

Just because it's not available from "Show All Available Commands" does not necessarily mean you'll not be able to use it. Add a command to the IDE and select it in the sequence of operations in your test (i.e. from the "Table" view not the "Source" view). Now you'll see the "Command", "Target" and "Value" for your selected operation; just change the command to the one you require.

Upvotes: 2

Related Questions