ashot
ashot copied to clipboard
not able to take all the web elements of the screen shot from phantomjs driver.
Hi,
I am not able to capture all the div elements of a page screen shot from the phantomjs driver. 1st div element will create the screenshot, for 2nd element onwards it will throw element not found from selenium due to the screenshot execution code. If I comment the Ashot screen shot execution code the elements are present,
for (final WebElement lement : rows) { final WebElement divElem = lement.findElements(By.xpath("div")).get(1); final Screenshot screenshot = new AShot().takeScreenshot(driver, divElem); ImageIO.write(screenshot.getImage(), "PNG", new File(filelocn)); }
This is the driver instantiation code.
final DesiredCapabilities caps = new DesiredCapabilities(); caps.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, driverLocn); caps.setJavascriptEnabled(true); caps.setCapability("takesScreenshot", true); final WebDriver driver = new PhantomJSDriver(caps); driver.manage().window().maximize(); driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS); driver.get(url);