package test; import java.rmi.UnexpectedException; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import com.applitools.eyes.BatchInfo; import com.applitools.eyes.RectangleSize; import com.applitools.eyes.selenium.fluent.Target; public class ComparingScreensExample { private static CompareEyes eyes; private static WebDriver driver; public static void main(String[] args) throws UnexpectedException { driver = new ChromeDriver(); eyes = new CompareEyes(); eyes.setApiKey(System.getenv("APPLITOOLS_API_KEY")); eyes.setEnableComparison(true); eyes.open(driver, "app", "test", new RectangleSize(1000, 600)); checkEnvironment("https://applitools.com/helloworld"); eyes.switchToComparisonMode(driver); checkEnvironment("https://applitools.com/helloworld?diff2"); eyes.close(); driver.quit(); } private static void checkEnvironment(String url) { driver.get(url); eyes.check("First", Target.window()); driver.findElement(By.tagName("button")).click(); eyes.check("Second", Target.window()); } }