Reputation: 51
Selected an element and wanted --> physically move the mouse cursor over it.
tried using Actions class provided with selenium.method used is moveToElement()
.
Actions actions = new Actions(driver);
actions.moveToElement(element).build().perform();
Used driver version is ChromeDriver 75.0.3770.90.
Expected :- Physical Cursor Must move to element location.
Upvotes: 2
Views: 2032
Reputation: 36
I had the same issue after upgrading to Chrome 75.
Actions actions = new Actions(driver);
actions.moveToElement(element).build().perform();
element.click();
That real solved the problem for me.
Upvotes: 2
Reputation: 1
I had the same problem with windows too, using chrome 75.0.3770.90
and chrome driver 75.0.3770.8
.
Try to do this :
actions.moveToElement(element).release().build().perform();
That solved the problem for me.
Upvotes: 0
Reputation: 17553
The method you are using seems correct. Looks either you need to wait as it quicky moves to next statement
Actions actions = new Actions(driver);
actions.moveToElement(element).build().perform();
try{
Thread.sleep(6000);
}
catch(Exception ex){
}
OR
Your element is not ready yet you need to wait for it like below:
Actions actions = new Actions(driver);
WebElement myDynamicElement = (new WebDriverWait(driver, 10))
.until(ExpectedConditions.presenceOfElementLocated(By.id("myDynamicElement")))
actions.moveToElement(element).build().perform();
Upvotes: 0