capybara icon indicating copy to clipboard operation
capybara copied to clipboard

evaluate script jquery+selenium recursion error

Open alexpooley opened this issue 16 years ago • 2 comments

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.

alexpooley avatar May 17 '10 08:05 alexpooley

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.

jnicklas avatar May 17 '10 08:05 jnicklas

I added a separate execute_script method which is to be used for this sort of thing, working around the issue.

jnicklas avatar Jun 29 '10 20:06 jnicklas