1.获取鼠标将移动到的元素
List list1 = driver.findElement(By.id("AAA")).findElements(By.className("BBB"));
WebElement we = list1.get(0);
2.鼠标移动
action.moveToElement(we).perform();
3.等待3s
Thread.sleep(4000);
4.JavascriptExecutor 定义
JavascriptExecutor js = (JavascriptExecutor) driver;
5.鼠标移动后出现的元素
WebElement logout = we.findElement(By.className("BBB"));
6.js操作上面的元素
js.executeScript("arguments[0].click();", logout);
7.点击“确定”按钮
driver.switchTo().alert().accept();