rspec - Capybara: get selected radio button using webkit or poltergeist -


it's easy enough selected radio button capybara using rack_test driver.

# rack_test page.set('input_id') # => "checked" page.find('[checked]') # => #<capybara::node::element tag="input" path="/html/body/p[1]/label[1]/input"> 

however, doesn't work webkit or poltergeist.

# webkit or poltergeist page.set('input_id') # => "" page.find('[checked]') capybara::elementnotfound: unable find css "[checked]" 

i've tried using #selected? method, doesn't seem working radio button.

# driver page.set('input_id') page.all('input').select(&:selected?) # => [] 

how can checked radio button capybara in webkit or poltergeist?

you running difference between attributes , properties in js supporting browsers. you've done in rack-test works because knows attributes. find checked input in other browsers do

find('input:checked') 

or things like

find(:checkbox, 'input_id', checked: true) find(:radio_button, 'input_id', checked: true) find(:field, 'input_id', type: 'checkbox', checked: true) 

etc...


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -