Javascript ubuntu上Google Chrome 75.0.3770.80上的Selenium操作moveToElement不起作用
选择了一个元素并希望-->将鼠标光标实际移动到该元素上 尝试使用selenium提供的Actions类。使用的方法是Javascript ubuntu上Google Chrome 75.0.3770.80上的Selenium操作moveToElement不起作用,javascript,selenium,selenium-chromedriver,Javascript,Selenium,Selenium Chromedriver,选择了一个元素并希望-->将鼠标光标实际移动到该元素上 尝试使用selenium提供的Actions类。使用的方法是moveToElement() 使用的驱动程序版本是ChromeDriver 75.0.3770.90 预期:-物理光标必须移动到元素位置。您使用的方法似乎正确。看起来您需要等待它快速移动到下一个语句 Actions actions = new Actions(driver); actions.moveToElement(element).build().perform(); tr
moveToElement()
使用的驱动程序版本是ChromeDriver 75.0.3770.90
预期:-物理光标必须移动到元素位置。您使用的方法似乎正确。看起来您需要等待它快速移动到下一个语句
Actions actions = new Actions(driver);
actions.moveToElement(element).build().perform();
try{
Thread.sleep(6000);
}
catch(Exception ex){
}
或
您的元素尚未准备好,您需要等待它,如下所示:
Actions actions = new Actions(driver);
WebElement myDynamicElement = (new WebDriverWait(driver, 10))
.until(ExpectedConditions.presenceOfElementLocated(By.id("myDynamicElement")))
actions.moveToElement(element).build().perform();
我在windows上也有同样的问题,使用chrome
75.0.3770.90
和chrome驱动程序75.0.3770.8
。
尝试这样做:
actions.moveToElement(element).release().build().perform();
这为我解决了问题。升级到Chrome 75后,我也遇到了同样的问题
Actions actions = new Actions(driver);
actions.moveToElement(element).build().perform();
element.click();
这才真正解决了我的问题。Hi shubham,这个问题的真正原因是ubuntu linux。代码在windows上运行得很好。谢谢。我会尝试你的代码,如果它运行的话,我会将它标记为已解决并接受的答案。
Actions actions = new Actions(driver);
actions.moveToElement(element).build().perform();
element.click();