After upgrade of Selenium from 3 to 4, the hover is not anymore performed in the following method:
public void mouseMoveToRightEdge(Element element) {
executeAction(element, new EventType(EventType.Message.ACTION_HOVER), (by, failedEx) -> {
WebElement webElement = driverServices.getDriver().findElement(by);
Dimension d = webElement.getSize();
int xOffset = d.width - 2; //Works on remote running (maven/selenoid) only when reducing 2 pixels
int yOffset = d.height / 2;
org.openqa.selenium.interactions.Actions builder = new org.openqa.selenium.interactions.Actions(driverServices.getDriver());
org.openqa.selenium.interactions.Actions hoverOverRightEdge = builder.moveToElement(webElement, xOffset, yOffset);
hoverOverRightEdge.perform();
return true;
});
}
Is there any better way in Selenium 4 to perform the hover to certain offsets? Are the offsets seen different in Selenium 4?
I tried to change the offsets to other values from the element and it didn't work. I tried to use clickAndHold method insetead moveToElement and it wasn't working either.