我无法使用带有以下代码的 webdriver 自动将鼠标悬停。如果有人给出解决方案,我将不胜感激
Actions builder = new Actions(driver);
WebElement el=driver.findElement(By.linkText("Account"));
System.out.println(el.getText());
builder.moveToElement(el);
Thread.sleep(5000);
WebElement ele1=driver.findElement(By.xpath("/html/body/form/div[3]/div/div/div[2]/ul/li[4]/div/ul/li[4]/a"));
System.out.println(ele1.getText());
builder.moveToElement(ele1);
builder.click();
builder.perform();
Thread.sleep(5000L);
org.openqa.selenium.NoSuchElementException: 无法定位元素: {"method":"xpath","selector":"/html/body/form/div[3]/div/div/div[2]/ul/ li[4]/div/ul/li[4]/a"}
它没有识别下拉元素。因此菜单中的项目不可见。这就是导致此错误的原因。