WebDriverJS: Hover over element


Assuming you have a driver launched and found the following WebElement:

const myElement = driver.findElement({ css: '#myElement' });

You can hover over it using the mouseMove action sequence:

driver.actions().mouseMove(myElement).perform();

Alternatively, you could move the mouse over the element location:

myElement.getLocation().then((location) => {
  driver.actions().mouseMove(location).perform();
});


Please support this site and join our Discord!