0
这是很容易使用rack_test
司机与水豚,以获得选定的单选按钮选择得单选按钮。水豚:使用webkit的或吵闹鬼
# with rack_test
page.set('input_id')
# => "checked"
page.find('[checked]')
# => #<Capybara::Node::Element tag="input" path="/html/body/p[1]/label[1]/input">
但是,这不适用于webkit或poltergeist。
# with webkit or poltergeist
page.set('input_id')
# => ""
page.find('[checked]')
Capybara::ElementNotFound: Unable to find css "[checked]"
我使用#selected?
方法也试过,但它似乎并不奏效单选按钮。
# with any driver
page.set('input_id')
page.all('input').select(&:selected?)
# => []
如何在webkit或poltergeist中使用水豚检查单选按钮?
这是它。谢谢! – steel