ashot icon indicating copy to clipboard operation
ashot copied to clipboard

not able to take all the web elements of the screen shot from phantomjs driver.

Open Shashi-GS opened this issue 5 years ago • 1 comments

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)); }

Shashi-GS avatar Nov 23 '18 10:11 Shashi-GS

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);

Shashi-GS avatar Nov 23 '18 10:11 Shashi-GS