殘疾場我有一個選擇框,一個標籤:查找與水豚
<label for="slide_orientation">Slide orientation</label>
<select disabled="" class="property" id="slide_orientation" name="slide_orientation">
<option value="horizontal">Horizontal</option>
<option value="vertical" selected="selected">Vertical</option>
</select>
正如你可以看到選擇框被禁用。當我試着使用field_labeled("Slide orientation")
找到它,它會返回一個錯誤:
Capybara::ElementNotFound: Unable to find field "Slide orientation"
from /Users/pascal/.rvm/gems/ruby-1.9.3-p392/gems/capybara-2.0.2/lib/capybara/result.rb:22:in `find!'
當選擇框未被禁用,field_labeled("Slide orientation")
返回選擇元素就好了。
這是預期的行爲?如果是這樣,我將如何去尋找一個禁用的元素?在我的情況下,我需要它來測試它是否被禁用。
按鈕的情況是一樣的:http://stackoverflow.com/questions/12917227/how-do-i-write-a-capybara-assertion-that-checks-for-the-presence-of-a -button-和 – 2014-10-15 15:22:52