oma
oma

Reputation: 40770

capybara finds button but clicking it does nothing

UPDATE: I removed most javascript dependencies and it worked. Don't know what library or code is the evil part, I needed none of it.


simple form, two input fields and a button

fill_in 'cellNumber', :with => '13245678'
fill_in 'password', :with => 'mypass'
click_button('OK')

It finds the button, but nothing happens.

Important!, if I click the myself, everything works as expected.

   <button type="submit" id="loginid">OK</button>
</form>

Using ruby-debug, I find that find_button("OK").click returns "". If not found would raise error. If I click manually inside the firefox window, halting the capybara test with sleep or in debug, I see (test window in focus) a blue frame has appeared around the button , as it's been selected somehow.

Anyway, I'm close to checking in to a mental facility right now... Any suggestions?

Upvotes: 4

Views: 1276

Answers (1)

oma
oma

Reputation: 40770

Javascript may interfere. The page had some unnecessary dependencies to Squeezebox, Mootools-1.2.5 and Function.cbb.js, so I just removed them and refactored to use more css functionality (like hover) and specialized js. I'm not impressed with this. Nonetheless, I hope this answer would help others.

update: Seems like Mootools is incompatible with Selenium. Without including any other JS library/code than the mootools core library, it breaks. I've tried both 1.2.5-core and 1.3.2-full-compact.

Upvotes: 2

Related Questions