capybara-envjs icon indicating copy to clipboard operation
capybara-envjs copied to clipboard

Couldn't find element inside the FancyBox container

Open millisami opened this issue 15 years ago • 11 comments

I'm using FancyBox to load the content via ajax request in a Rails3rc app.

The following is the feature which passes/works in development, testing via browser, but when I try to test it via envjs, it blows up. Then I should see "You are Doing Good" within "#fancybox-inner" # features/step_definitions/web_steps.rb:107 scope '//[@id = 'fancybox-inner']' not found on page (Capybara::ElementNotFound) ./features/step_definitions/web_steps.rb:14:in with_scope' ./features/step_definitions/web_steps.rb:108:in/^(?:|I )should see "([^"])"(?: within "([^"]*)")?$/' features/homepage.feature:34:in `Then I should see "You are Doing Good" within "#fancybox-inner"' This is the generated link to be clicked. Do Good

And this is the jquery/fancybox hook that makes it work. jQuery(document).ready(function($) { $("a.do_good_order").fancybox({ 'hideOnContentClick': true, 'width': 400, 'height': 300, 'autoScale': false, 'autoDimensions': false }); });

From the error above, its complaining about the scope '//*[@id = 'fancybox-inner']' not found on page (Capybara::ElementNotFound)

So, my question is, does capybara-envjs supports or can detect the elements inside the #fancybox-inner div which is a overlayed container of FancyBox??

millisami avatar Aug 16 '10 12:08 millisami

Overlays should be fine: they're still in the DOM.

You could try seeing if it's getting created, by looking at the innerHTML of the container ...

smparkes avatar Aug 19 '10 18:08 smparkes

Well, the same code above does work with selenium webdriver when I run the feature. I hope this confirms that the innerHTML is right.

When I change the capybara driver to use envjs, it fails.

millisami avatar Aug 20 '10 07:08 millisami

Sorry; didn't mean to imply that the code wasn't right. I actually suspect some event processing isn't working and the overlay DOM elements aren't getting created. But I'm not sure.

Can you put an example somewhere I can try?

smparkes avatar Aug 20 '10 13:08 smparkes

Alright, here is the repo http://github.com/millisami/capybara-envjs-experiment It has two branches. master branch has the selenium one which works and another branch named envjs, which uses the envjs modified one which is failing.

millisami avatar Aug 25 '10 05:08 millisami

Thanks. I'll try to look at this this weekend.

smparkes avatar Aug 25 '10 16:08 smparkes

Sure, I am waiting eagerly coz I don't like the selenium opening firefox everytime. It drgas me.

millisami avatar Aug 26 '10 03:08 millisami

Hi, did you get any time to look up the problem??

millisami avatar Aug 31 '10 08:08 millisami

Still trying. Time's tight.

smparkes avatar Sep 02 '10 02:09 smparkes

Looks like you need style support that's not in envjs.

I had to tweak a couple of things to get the test to work: I had to comment-out the javascript emulation stuff in the config and it looks like the javascript support was turned off (#@javascript?)

When I did that, it caused errors in env-js's timer loop. The fancybox code is trying to do something with the CSS style attribute which is not currently supported (at least in the johnson fork ... not sure where the rhino port stands on this).

smparkes avatar Sep 02 '10 17:09 smparkes

So, does that mean I have to abandon it for a while ?

millisami avatar Sep 03 '10 03:09 millisami

At this point, I don't see this getting worked on by me in the next month or two. I'd like to, at some point, but I'm not sure when that's going to be possible. So unless someone steps up ...

smparkes avatar Sep 03 '10 15:09 smparkes