0

In Selenium/Chromedriver it is possible to execute arbitrary jQuery selectors and receive a list of native Selenium::WebDriver::Elements:

page.evaluate_script("$('.some_class')")

=> [#<Selenium::WebDriver::Element:0x1 id="...">, ...]

When I execute the same selector in in Poltergeist/PhantomJS I get the following:

page.evaluate_script("$('.some_class')")

=> "(cyclic structure)"

Is there any way to get Poltegeist/PhantomJS to return the Poltergeist-equivalent list of elements?

I know about find(:css, ".some_class"), but I'm trying to expose Angular's getTestability interface to access models, bindings, etc from within Capybara...see capybara-ng, which only works in Selenium.

Joseph Siefers
  • 1,282
  • 1
  • 12
  • 23
  • This is probably not easily doable, because GhostDriver (the WebDriver implementation of PhantomJS) is running in the page context and it is not possible to pass DOM elements from the page context to the outside. So they have to be mapped somehow. – Artjom B. Mar 09 '15 at 23:21
  • You will have to write your test script completely in the page context (in `page.evaluate_script()`) – Artjom B. Mar 09 '15 at 23:32
  • possible duplicate of [Injecting & using Firebug-Lite with PhantomJS](http://stackoverflow.com/questions/9728673/injecting-using-firebug-lite-with-phantomjs) – Paul Sweatte Jul 20 '15 at 13:43
  • Have you found a solution to this problem? Because I am having the exact same issue as you! – Feytality Apr 21 '16 at 18:34

0 Answers0