nightwatch.js - Hovering with moveTo or moveToElement -
i'm having trouble getting background color of link using following code , selenium stand-alone 2.53.0 , firefox 50.0.2661.75 m or chrome latest:
although during test don't see mouse moving, @ bottom of browser's window in status bar, see url change href of link.
i cannot seem trigger hover event elements, background color default color , not hovered stated color. ideas around this?
browser.movetoelement('a[href="http://www.foo.com"]',2,2, function() { browser.pause(2000) .getcssproperty('a[href="http://www.foo.com"]', "background-color", function(results){ console.log('color: ' + results); }); });
if remove getcssproperty callback, i'm still not getting right background color hover , not seeing mouse pointer move:
browser.movetoelement('a[href="http://www.foo.com"]',2,2) .pause(2000) .getcssproperty('a[href="http://www.foo.com"]', "background-color", function(results){ console.log('color: ' + results); });
you won't see physical mouse pointer move. selenium doesn't move mouse simulates events in browser.
also, if physical mouse in window, it'll mess events being generated , won't see colors change properly, etc.
the fix: if want test hovering, move actual mouse bottom right hand corner of screen before test starts. leave there duration of test.
Comments
Post a Comment