How to Mouse Hover over different images with dynamic xpaths through Selenium Java
问题 There are seven images. I want to do mouse hover on every image and and check AddToCart button is displayed or not. I have tried following code and it is not working. Reference: http://automationpractice.com/index.php public boolean checkMouseHoveronAllItems(WebDriver driver) { String xpathOfItems="//[@id='homefeatured']/li['+index+']/div/div[1]/div/a[1]/img"; String xpathOfAddToCartButtons="//div[@class='button-container']/a[@title='Add to cart']"; boolean res=false; for(int index=1;index<