0

嗨,我对使用 Ruby/Capybara 和 RSPEC 还很陌生...我正在尝试从下拉选择框中选择月份,其值如下

<legend> Expiration Date </legend>
</div>
<ul>
<li class="select input required"
    id="cart_driver_attributes_credit_card_attributes_exp_month_input">
    <select autocomplete="off" class="required select-box expiration-date"
        id="cart_driver_attributes_credit_card_attributes_exp_month"
        name="cart[driver_attributes][credit_card_attributes][exp_month]">
        <option value="">Month</option>
        <option value="01">January</option>
        <option value="02">February</option>
        <option value="03">March</option>
        <option value="04">April</option>
        <option value="05">May</option>
        <option value="06">June</option>
        <option value="07">July</option>
        <option value="08">August</option>
        <option value="09">September</option>
        <option value="10">October</option>
        <option value="11">November</option>
        <option value="12">December</option>
    </select>

==================================================== =======================

我正在使用以下内容来选择月份

select "August", :from => "select"

我尝试了几种方法来选择一个月,但我一直得到Capybara::ElementNotFound:

4

1 回答 1

1

:from选项接受选择(文档)的 id、名称或标签。所以在你的情况下:

select "August", :from => "cart_driver_attributes_credit_card_attributes_exp_month"
于 2013-09-26T00:30:58.950 回答