Closed majioa closed 7 years ago
Other than JS the other major difference between running in JS and non-JS mode is that when in JS mode the drivers generally fully process CSS. If you look at your html in a real browser it's highly likely your radio button elements are actually hidden and replaced with images that allow them to look the same across multiple browsers. In newer versions of Capybara there are options for dealing with that which can be passed to #choose
however in version 2.7.x you'll need to manually click the label element associated with the radio. In your case that's probably
find(:label, "$ 39.99 /year").click
@twalpole which version supports that keys? and how to use them?
@majioa It was added in 2.8.0 and then had a fix in 2.9.1 - https://github.com/jnicklas/capybara/blob/master/History.md. It can be used like
choose("$ 39.99 /year", allow_label_click: true) # or set the global Capybara.automatic_label_click = true
Currently on the version
capybara
= 2.7.0 andcapybara-webkit
= 1.11.1 I get strange behaviour of the driver. When javascript is disabled (no@javascript
tag declared in the cucumber env) the code selecting a radio button works fine:When I enable js with
@javascript
tag in cucumber test env, I get the following error:I'm pretty sure that the HTML code is the same, I've got it with launchy's
save_and_open_page
method.Why the behaviour is rise up, and how to fix it?