I am using rspec-capybara for my tests and I am clicking on a button which had been placed there through Javascript (ajax).

Clicking on the button works when using WebDrivers for Chrome, Firefox and Internet Explorer, but doesn't work in Safari. It can't find the button to click on.

We do our cross-browser testing through Browserstack automation, not sure if that is part of the problem.

I'm using a newer model (2015) Mac.

1 Answer 1


After working on this for a few hours with a colleague and doing some in-browser debugging in Safari we came to the following conclusion:

The element was not visible ('below the fold') and Safari was not able to find the element to then click on.

The solution was to scroll to the area of the page where the element existed

by finding a nearby element that was present on initial page load, e.g. a nearby find(input#some_id) to force the scroll.
Then clicking on the button in question (now visible) worked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.