AJ.
AJ.

Reputation: 119

Watir question regarding selecting a hidden dropdown

I have two dropdowns, the second dropdown does not show until a choice is made from the first one. Using watir, i can select the first dropdown, and when i watch it, the second one becomes active, but it cannot select it. i just tried the regular select_list using name and id. Here is the code for the second drop down.

<td>
<input type="hidden" value="1" name="list" id="list">
<script type="text/JavaScript" language="JavaScript"></script>
<select>
<option value="">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</td>

I've also notice the value for the hidden field change as i select different options. Thanks for any help

Upvotes: 3

Views: 1352

Answers (3)

unknownbits
unknownbits

Reputation: 2885

Try this:

browserObj = Watir::Browser.new
browserObj.goto('you html in browser')
//browserObj.hidden(:id,"list").value
browserObj.select_list(:name, "list").select_value('2')

Upvotes: 0

user2087869
user2087869

Reputation: 11

I usually select hidden dropdowns this way

ie.hidden(:name=>"list").value='2'

Upvotes: 1

Curtis Miller
Curtis Miller

Reputation: 578

The way that I usually access drop down lists is by using this string:

@browser.select_list(:name, "list").set("3")

Does this help?

Upvotes: 1

Related Questions