selenium测试的时候发现了这样一个错误:
addToCart() : 有异常unknown error: Element is not clickable at point (996, 513). Other element would receive the click: <img src="//d3369mzfitsk4k.cloudfront.net/public/vbridal/images/color_dress/other/champagne.jpg?2012d2c7507_" alt="">
原因:用selenium模拟用户单击元素的时候,JS有一个操作鼠标悬浮的时候会对元素进行修改
解决办法:用JS来操作元素
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("arguments[0].click();",driver.findElement(xpath));