Reputation: 13
I have tried a number of Ruby/Watir options to identify these two radio buttons and I can't do it. I want to .flash
the radio button first then .set
one of them.
browser.radio(:name => "appchoice_apps", :text => "Supervisor Console").flash
browser.radio(:span => "appchoice_supervisor").flash
I am not sure what else to try. I am very new here and I apologize for burning up your time.
<span id="appchoice_supervisor" style="visibility: visible;">
<input type="radio" name="appchoice_apps"></input>
Supervisor Console
</span>
<span id="appchoice_oa" style="display: block;">
<input type="radio" checked="" name="appchoice_apps"><input>
Associate Desktop
<br></br>
</span>
Upvotes: 0
Views: 92
Reputation: 46846
Solution 1 - By Text
The first example will not work because the text "Supervisor Console" is a sibling of the radio button rather than a text of the radio button.
browser.radio(:name => "appchoice_apps", :text => "Supervisor Console").flash
To check the sibling text, you can try getting the span by its text and then navigating to the radio button:
browser.span(:text => "Supervisor Console").radio.flash
Solution 2 - By Parent ID
The second example will not work because span
is not a valid identifier.
browser.radio(:span => "appchoice_supervisor").flash
Like the first solution, you can locate the span by its id and then look for a radio button within that span:
browser.span(:id => "appchoice_supervisor").radio.flash
Upvotes: 2