unfortunately these work arounds will not work for css :hover based drop down menus, which are very common( especially in my app ;).
naively, and without understanding at all how phantom.js works, i'm thinking, "why can't i just get the coordinates for that element and move the mouse over it?" ideally node would have a method hover() which moves some phantom cursor over it, or at least convinces webkit that this has happened.
is this at all within the realm of possibility?
I'm trying to convert a test suite from Capybara-Headless-Webkit to Poltergeist and am running into the same problem. The only "solution" I've come up with is not to include the stylesheet <link> tag in the test environment.
It appears that mouseover might not be a supported event with PhantomJS http://code.google.com/p/phantomjs/wiki/Interface#sendEvent(type,_...)
I think this might be possible using page.sendEvent('mousemove', ...), but I haven't tried. I would be open to implementing it as a non-standard thing at the driver level, but it would also be great if someone has some time to open a discussion about an official API for this in Capybara itself.
What about using a hover event, or at least a mouseenter, so we don't have to calculate coordinates and pass them in?
I am also willing to implement a #hover API along the following lines:
However, before adding this to Poltergeist I would want someone to get it officially supported in Capybara so we are not diverging.
(The rule is that page.driver.foo can be non-standard, but other stuff has to be specced by capybara.)
(When I say "willing", I mean "willing to review/merge code", rather than "willing to do the work" ;)
Oh, I understood :)
It looks like Capybara prefers trigger('mouseover'). Cf Capybara #387 and Capybara #116.
@jamesarosen it would be a good idea to open a ticket about this against capybara and get the opinion of the maintainers. AFAIK the #trigger API is a way to trigger DOM events, but what we're talking about is not triggering a DOM event - we want to literally simulate a mouse move over the element with all the relevant side-effects such as css :hover.
Requested in jnicklas/capybara#832
Capybara just implemented hover and window-resize: jnicklas/capybara#965
@jonleighton how can I help make this happen?
Closing this because of Jon's commit 6c52e69