I am trying Visual Regression and want to compare a specific part of the screenshot. Could you please help?

I am trying Visual Regression and want to compare a specific part of the screenshot and want to see a preview of the values defined under “Area” tab so that I can adjust it accordingly.

Hello Charity,

To see a preview of the values defined under “Area” tab to adjust, you can use the following code snippet.

package magicleapTesting;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Hashtable;

public class VR{
    public static void main(String[] args) throws MalformedURLException, InterruptedException {
        RemoteWebDriver driver = null;


        Hashtable<String, Integer> errorColor= new Hashtable<>();
        errorColor.put("red",200);
        errorColor.put("green",200);
        errorColor.put("blue",0);

        Hashtable<String, Integer> box= new Hashtable<>();
        box.put("left",20);
        box.put("top",20);
        box.put("right",22);
        box.put("bottom",60);


        HashMap<String,Object> output= new HashMap<String, Object>();
        output.put("errorColor",errorColor);//Output Difference error color
        output.put("errorType","movement");//Flat Differences/Movement
        output.put("transparency",0.5);// Set transparency of Output
        output.put("largeImageThreshold",1200);// the granularity to which the comparison happens(the scale or level of detail in a set of data.)Range-100-1200
        output.put("useCrossOrigin",false);//source -localmachine
        output.put("outputDiff",true);//don't want to comparison set as false
        output.put("boundingBox", box);

        HashMap<String, Object> sm=new HashMap<String, Object>();
        sm.put("output",output);
        sm.put("scaleToSameSize",true);//scale to same size
        sm.put("ignore","antialiasing");//remove picture grouping


        String username = "abidk";
        String access_key = "";



        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability("build", "VisualUI");
        capabilities.setCapability("name", "Visual Ui Testing");
        capabilities.setCapability("platform", "Windows 10");
        capabilities.setCapability("browserName", "chrome");
        capabilities.setCapability("version","latest");


        capabilities.setCapability("visual",true);
        capabilities.setCapability("smartUI.project","ProjectD");

        // capabilities.setCapability("smartUI.build"," build1 ");
        capabilities.setCapability("smartUI.options",sm);
        // capabilities.setCapability("smartUI.baseline", true);

        driver = new RemoteWebDriver(new URL("http://" + username + ":" + access_key + "@beta-smartui-hub.lambdatest.com/wd/hub"), capabilities);
     

        driver.get("https://lambdatest.com/");

        //Thread.sleep(4000);

        driver.executeScript("smartui.takeScreenshot");


        driver.executeScript("lambda-status=passed");
        driver.quit();

    }
}