我有一个带有标签的选择框:
<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!'
When the select box is not disabled, field_labeled("Slide orientation")
returns the select element just fine.
这是预期的行为吗?如果是这样,我将如何寻找禁用的元素?就我而言,我需要它来测试它是否被禁用。