divan divan - 10 months ago 202
Javascript Question

Selenium IE Webdriver Hovering Over Element flickering

My code works perfectly fine in FF but if I try with IE it flicker.

Below is my code

WebElement mouseOver= driver.findElement(By.linkText("abc"));
//I'm finding element by linkText. Selenium find the linktext, Next im using Action class to perform the move.
Actions action = new Actions(driver);

Once action move to Element line is trigger it seems it goes thru loop or something mouse is keep going over the linkText "abc". Since it flicker its not able to move to next Element. I'm using thread.sleep as there is other items which suppose to display after it hover to the element usually it takes about 1 sec to appear.

I checked following link , stated

The prevailing theory why this occurs is that IE is doing hit-testing
of some sort during its event loop, which causes it to respond to the
physical mouse position when the physical cursor is within the window

Is that mean hover will not work in IE. is there any solution to flickering ?


While creating your Driver you can try this. This worked for me:

DesiredCapabilities returnCapabilities = DesiredCapabilities.internetExplorer();
returnCapabilities.setCapability(InternetExplorerDriver.ENABLE_PERSISTENT_HOVERING, false);
WebDriver driver = new InternetExplorerDriver(returnCapabilities);