简体   繁体   中英

Trying to select radio button with Watir

I am trying to select a radio button which i have done on other pages but cant seem to get this one to work

Here is the html for the radio button I am trying to access:

<fieldset id="category_fieldset">

<div class="group category first">
    <label class="label"></label>
    <div id="category_options">
        <div class="toggle-btn">
            <input id="category_rental" type="radio" value="rental" name="fields[category]"></input>
            <label for="category_rental">
                <span></span>
                For Rent
            </label>

Here are the --- i have made (none of these have worked)

browser.radio(:name => "fields[category]").set

browser.radio(:id => "category_rental").click

browser.radio(:value => "rental").click

thanks for the feedback on this

i tried this and seems to work

browser.label(:text => "For Rent").click

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM