Open sasikumar76 opened 6 years ago
Hi, I am facing the same issue, is it working for you now?
Take the screenshot of a specific element with co-ordinates Provider. Below code should work.
Screenshot myScreenshot = new AShot().coordsProvider(new WebDriverCoordsProvider()).takeScreenshot(driver, specificElemement);
even with Screenshot myScreenshot = new AShot().coordsProvider(new WebDriverCoordsProvider()).takeScreenshot(driver, specificElemement);
screenshot is not captured. Does someone know the solution?
@Chaitalii please provide details: website URL, element locator, code snippet, any logs if you have
@valfirst thanks for the reply. For making POC, I tried with the simplest of simplest case: capture screenshot of google logo. Also, I am attaching the POM from my project just in case you want to see the versions involved.
driver.get("http://www.google.com");
WebElement element = driver.findElement(By.xpath("//div[@id='lga']//img"));
Screenshot logoImageScreenshot = new AShot().coordsProvider(new WebDriverCoordsProvider()).takeScreenshot(driver, element);
ImageIO.write(logoImageScreenshot.getImage(), "PNG",
new File(System.getProperty("user.dir") + "\\screenshots\\"+"logo.png"));
Hi i am unable to take the right screenshot locally and i am using Mac but if run my test in docker i am able to take the screenshot of the element . WebElement logoImageElement = baseContext.driver.findElement(By.xpath("//div[@id='divLogo']//img")); Screenshot logoImageScreenshot = new AShot().coordsProvider(new WebDriverCoordsProvider()) .takeScreenshot(baseContext.driver,logoImageElement ); .Not sure where the problem lies.
@mehak-arora please provide actual and expected results
When i use Ashot with selenium to capture screenshot for particular webelement,its not working.
I have also attached the logs for reference.
Screenshot for taking full page is working.
Iam using Chrome Driver ,selenium 3.8.1 standalone jar, Ashot 1.5.2 jar.
}
Added screenshot :
[![enter image description here][2]][2]
Error Message :