AI Based Visual Reg...
Clear all

[Solved] AI Based Visual Regression Testing

New Member Guest
Joined: 1 year ago
Posts: 1
Topic starter  

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?

Amrita Kaur
Member Admin
Joined: 3 years ago
Posts: 107

For individual elements, all you need to do is pass base64 string for that specific element:

Sample using Ashot:

		WebElement imgJava = driver.findElement("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);