Forum

Forum
AI Based Visual Reg...
 
Notifications
Clear all

[Solved] AI Based Visual Regression Testing

New Member Guest
Joined: 2 years 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: 4 years ago
Posts: 108
 

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