evaluate script jquery+selenium recursion error
Our page uses jQuery events. Using capybara+selenium we're triggering the events using evaluate_script. The web driver makes some complaint about recursion and then returns an error.
Our call is something like this: page.evaluate_script("$(#some input).change()")
Our fix is to do this: page.evaluate_script("$(#some input).change() && false")
There's something about the implicit "return" in the evaluate_script method in capybara that is causing the script to run over and over again (I think).
I had a quick look but couldn't create a proper test. I wanted to document the issue here as I've seen others with similar problems.
There already was an issue for this: http://github.com/jnicklas/capybara/issues/closed#issue/71
I closed it, because the problem lies in webdriver and not in Capybara. I'm going to leave this issue open for now, just as a flag to people that this is a problem.
I added a separate execute_script method which is to be used for this sort of thing, working around the issue.