You can also do this in WebDriver (Selenium 2 coming soon). The following example is for TestNG / Java, but other client languages โโare available.
List<WebElement> images = driver.findElements(By.xpath("//img[not(@alt)]")); assertEquals(images.size(), 0);
For more information, you can also use something like the following to display image details without alt attributes:
for(WebElement image : images) { System.out.println(image.getAttribute("src")); }
Dave hunt
source share