Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoMethodError: undefined method `compact' for "(cyclic structure)":String #13

Closed
miks opened this issue Sep 20, 2019 · 3 comments
Closed

Comments

@miks
Copy link

miks commented Sep 20, 2019

When using together with Cuprite and executing Rspec command like:
page.evaluate_script("jQuery('body').addClass('not-reloaded');")
it's erroring with:

NoMethodError: undefined method `compact' for "(cyclic structure)":String
from (pry):5:in `rescue in handle_response'
Caused by NoMethodError: undefined method `compact' for "(cyclic structure)":String
from ~/.rvm/gems/ruby-2.5.3/bundler/gems/ferrum-5b6cb3f617b0/lib/ferrum/page/runtime.rb:127:in `handle_response'

Correspoding reduce_props(object_id, []) at https://github.com/route/ferrum/blob/master/lib/ferrum/page/runtime.rb#L122 is returning "(cyclic structure)" String, so it's clear why compact call is failing.

Not sure what's best approach to handle this case.

@route
Copy link
Member

route commented Sep 20, 2019

Me neither but otherwise you'd get Stack Level too deep (SystemStackError) because it is cyclic structure... I checked selenium and this bugs them as well, though I'd prefer returning something meaningful rather then SystemStackError.

@BenoitMC
Copy link

BenoitMC commented Oct 2, 2019

Try to replace evaluate_script by execute_script if you don't need the return, it solved the problem for me.

@miks
Copy link
Author

miks commented Oct 3, 2019

@BenoitMC that did it, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants