Notifications
Clear all
Topic starter
09/09/2022 5:02 pm
I want to validate only specific components instead of the whole page. These components often change locations:
- Logo
- Product Pictures etc.
How does Imagium support individual elements instead of home page?
13/10/2022 6:18 pm
For individual elements, all you need to do is pass base64 string for that specific element:
Sample using Ashot:
driver.get("https://www.google.com/"); WebElement imgJava = driver.findElement(By.name("q")); Screenshot screenshot = new AShot().coordsProvider(new WebDriverCoordsProvider()).takeScreenshot(driver,imgJava); ByteArrayOutputStream out = new ByteArrayOutputStream(); ImageIO.write(screenshot.getImage(),"PNG", out); byte[] bytes = out.toByteArray(); String imagebase64 = Base64.encodeBase64String(bytes);