//Click the ("Image Statistics") button to load an AJAX page
driver.findElement(By.cssSelector("a[title=\"Image Statistics\"] > img")).click();
//Wait for an AJAX Element ("Summed Images Impressions by Region")
WebElement summed_img = WaitTool.waitForElement(driver, By.xpath("//div[@id='statistics']/img[3]"), 5);
//Wait for an AJAX Element ("Directories Visits")
WebElement directory_img = WaitTool.waitForElement(driver, By.xpath("//div[@id='statistics']/img[5]"),5 );
if(summed_img != null && directory_img != null){
// compare with expected values with the actual values
assertEquals("Image width" , 400, summed_img.getSize().width);
assertEquals("Image height" , 250, summed_img.getSize().height);
System.out.println("Summed image size: " + summed_img.getSize());
assertEquals("Image width" , 800, directory_img.getSize().width);
assertEquals("Image height" , 250, directory_img.getSize().height);
System.out.println("directory image size: " + directory_img.getSize());
}else{
Assert.fail("Verify Failed: fail for waiting AJAX elements");
}
}