2014-10-02 33 views
1

我有2個下拉列表以2種不同的形式。
我的html代碼:如何使用水豚選擇一個下拉列表

<form id = "frm1"> 
    <select name="time_zone" class="time_zone chosen"> 
    <option value="International Date Line West">(GMT-11:00) International Date Line West</option> 
    </select> 
</form> 

和:

<form class="new-user"> 
    <select name="time_zone" class="time_zone chosen"> 
    <option value="International Date Line West">(GMT-11:00) International Date Line West</option> 
    </select> 
</form> 

我想選擇在FRM2 DDL,但我不知道如何選擇。
有人可以幫我嗎?
在此先感謝。

回答

1
within '.new-user' do 
    select 'Something', from: 'time_zone' 
end 
+1

SR而是形成2沒有ID我輸入錯誤代碼:( – beginerdeveloper 2014-10-02 08:04:43

+0

@beginerdeveloper,你可以使用任何選擇作爲'within'參數。 – 2014-10-02 08:06:04

+1

好的,謝謝讓我們試試看 – beginerdeveloper 2014-10-02 08:06:51

0

這裏有一個襯墊使用水豚:

page.find('.new-user .time_zone option', :text => 'something').click 
相關問題