The website has standard image which i can use to identify the xpath. but i want to click on the third image which contains specific text only. the picture is beside the image, it that fine to have img and text in one command line?
Original working code:
driver.findElement(By.xpath("(//img[@class='s-image'])[2]")).click();
Try to insert the contains command but it does not work:
driver.findElement(By.xpath("(//img[@class='s-image'])[2] and contains(text(),'Apple MacBook Pro')")).click();