Class Eyes

  • All Implemented Interfaces:
    com.applitools.eyes.IEyesBase

    public class Eyes
    extends Object
    implements com.applitools.eyes.IEyesBase
    • Constructor Detail

      • Eyes

        public Eyes()
        Instantiates a new Eyes.
      • Eyes

        public Eyes​(com.applitools.eyes.EyesRunner runner0)
        Instantiates a new Eyes.
        Parameters:
        runner0 - the runner
    • Method Detail

      • setNMGCapabilities

        public static void setNMGCapabilities​(org.openqa.selenium.remote.DesiredCapabilities caps)
      • setNMGCapabilities

        public static void setNMGCapabilities​(org.openqa.selenium.remote.DesiredCapabilities caps,
                                              String apiKey)
      • setNMGCapabilities

        public static void setNMGCapabilities​(org.openqa.selenium.remote.DesiredCapabilities caps,
                                              String apiKey,
                                              String eyesServerUrl)
      • setNMGCapabilities

        public static void setNMGCapabilities​(org.openqa.selenium.remote.DesiredCapabilities caps,
                                              String apiKey,
                                              String eyesServerUrl,
                                              com.applitools.eyes.ProxySettings proxySettings)
      • setMobileCapabilities

        public static void setMobileCapabilities​(org.openqa.selenium.remote.DesiredCapabilities caps)
      • setMobileCapabilities

        public static void setMobileCapabilities​(org.openqa.selenium.remote.DesiredCapabilities caps,
                                                 String apiKey)
      • setMobileCapabilities

        public static void setMobileCapabilities​(org.openqa.selenium.remote.DesiredCapabilities caps,
                                                 String apiKey,
                                                 String eyesServerUrl)
      • setMobileCapabilities

        public static void setMobileCapabilities​(org.openqa.selenium.remote.DesiredCapabilities caps,
                                                 String apiKey,
                                                 String eyesServerUrl,
                                                 com.applitools.eyes.ProxySettings proxySettings)
      • getConfiguration

        public com.applitools.eyes.selenium.Configuration getConfiguration()
      • setConfiguration

        public void setConfiguration​(com.applitools.eyes.config.Configuration configuration)
      • configure

        public com.applitools.eyes.config.Configuration configure()
      • getApiKey

        public String getApiKey()
        Gets api key.
        Specified by:
        getApiKey in interface com.applitools.eyes.IEyesBase
        Returns:
        the api key
      • setApiKey

        public void setApiKey​(String apiKey)
        Sets api key.
        Parameters:
        apiKey - the api key
      • getServerUrl

        public URI getServerUrl()
        Specified by:
        getServerUrl in interface com.applitools.eyes.IEyesBase
      • setServerUrl

        public void setServerUrl​(String serverUrl)
        Sets server url.
        Parameters:
        serverUrl - the server url
      • setServerUrl

        public void setServerUrl​(URI serverUri)
        Sets server url.
        Parameters:
        serverUri - the server URI
      • setProxy

        public void setProxy​(com.applitools.eyes.AbstractProxySettings proxySettings)
        Sets the proxy settings to be used by the server.
        Parameters:
        proxySettings - The proxy settings to be used by the server. If null then no proxy is set.
      • getProxy

        public com.applitools.eyes.AbstractProxySettings getProxy()
        Gets proxy.
        Returns:
        The current proxy settings used by the server, or null if no proxy is set.
      • setIsDisabled

        public void setIsDisabled​(Boolean isDisabled)
        Sets is disabled.
        Specified by:
        setIsDisabled in interface com.applitools.eyes.IEyesBase
        Parameters:
        isDisabled - If true, all interactions with this API will be silently ignored.
      • getIsDisabled

        public Boolean getIsDisabled()
        Gets is disabled.
        Specified by:
        getIsDisabled in interface com.applitools.eyes.IEyesBase
        Returns:
        Whether eyes is disabled.
      • getRotation

        public com.applitools.eyes.selenium.positioning.ImageRotation getRotation()
        Returns:
        The image rotation data.
      • setRotation

        public void setRotation​(com.applitools.eyes.selenium.positioning.ImageRotation rotation)
        Parameters:
        rotation - The image rotation data.
      • setForceFullPageScreenshot

        public void setForceFullPageScreenshot​(boolean shouldForce)
      • getForceFullPageScreenshot

        public Boolean getForceFullPageScreenshot()
      • setMatchTimeout

        public void setMatchTimeout​(int ms)
        Sets the maximum time (in ms) a match operation tries to perform a match.
        Parameters:
        ms - Total number of ms to wait for a match.
      • getMatchTimeout

        public Integer getMatchTimeout()
        Returns:
        The maximum time in ms (RegionProvider, String, boolean, int)} waits for a match.
      • setSaveNewTests

        public void setSaveNewTests​(boolean saveNewTests)
        Set whether or not new tests are saved by default.
        Parameters:
        saveNewTests - True if new tests should be saved by default. False otherwise.
      • getSaveNewTests

        public Boolean getSaveNewTests()
        Gets save new tests.
        Returns:
        True if new tests are saved by default.
      • setSaveDiffs

        public void setSaveDiffs​(Boolean saveDiffs)
      • getSaveDiffs

        public Boolean getSaveDiffs()
      • setDefaultMatchSettings

        public void setDefaultMatchSettings​(com.applitools.eyes.ImageMatchSettings defaultMatchSettings)
      • getDefaultMatchSettings

        public com.applitools.eyes.ImageMatchSettings getDefaultMatchSettings()
      • getStitchOverlap

        public Integer getStitchOverlap()
        Gets stitch overlap.
        Returns:
        Returns the stitching overlap in pixels.
      • setStitchOverlap

        public void setStitchOverlap​(int pixels)
        Sets the stitching overlap in pixels.
        Parameters:
        pixels - The width (in pixels) of the overlap.
      • setBranchName

        public void setBranchName​(String branchName)
      • getBranchName

        public String getBranchName()
      • setParentBranchName

        public void setParentBranchName​(String branchName)
      • getParentBranchName

        public String getParentBranchName()
      • setBatch

        public com.applitools.eyes.config.Configuration setBatch​(com.applitools.eyes.BatchInfo batch)
      • getBatch

        public com.applitools.eyes.BatchInfo getBatch()
      • setAgentId

        public void setAgentId​(String agentId)
      • getAgentId

        public String getAgentId()
      • getFullAgentId

        public String getFullAgentId()
        Gets full agent id.
        Specified by:
        getFullAgentId in interface com.applitools.eyes.IEyesBase
        Returns:
        The full agent id composed of both the base agent id and the user given agent id.
      • setHostOS

        public void setHostOS​(String hostOS)
      • getHostOS

        public String getHostOS()
      • setHostApp

        public void setHostApp​(String hostApp)
      • getHostApp

        public String getHostApp()
      • getIgnoreCaret

        public Boolean getIgnoreCaret()
      • setIgnoreCaret

        public void setIgnoreCaret​(boolean value)
      • setMatchLevel

        public void setMatchLevel​(com.applitools.eyes.MatchLevel matchLevel)
      • getMatchLevel

        public com.applitools.eyes.MatchLevel getMatchLevel()
      • setEnvName

        public void setEnvName​(String envName)
      • getEnvName

        public String getEnvName()
      • setBaselineEnvName

        public void setBaselineEnvName​(String baselineEnvName)
      • getBaselineEnvName

        public String getBaselineEnvName()
      • setBaselineBranchName

        public void setBaselineBranchName​(String branchName)
      • getBaselineBranchName

        public String getBaselineBranchName()
      • setIgnoreDisplacements

        public void setIgnoreDisplacements​(boolean isIgnoreDisplacements)
      • getIgnoreDisplacements

        public Boolean getIgnoreDisplacements()
      • open

        public org.openqa.selenium.WebDriver open​(org.openqa.selenium.WebDriver driver,
                                                  com.applitools.eyes.config.Configuration configuration)
      • open

        public org.openqa.selenium.WebDriver open​(org.openqa.selenium.WebDriver driver,
                                                  String appName,
                                                  String testName,
                                                  com.applitools.eyes.RectangleSize viewportSize)
        See open(WebDriver, String, String, RectangleSize, SessionType). sessionType defaults to null. * @param driver The web driver that controls the browser hosting the application under test.
        Parameters:
        appName - The name of the application under test.
        testName - The test name. (i.e., the visible part of the document's body) or null to use the current window's viewport.
        Returns:
        A wrapped WebDriver which enables SeleniumEyes trigger recording and frame handling.
      • open

        public org.openqa.selenium.WebDriver open​(org.openqa.selenium.WebDriver driver,
                                                  String appName,
                                                  String testName)
      • open

        protected org.openqa.selenium.WebDriver open​(org.openqa.selenium.WebDriver driver,
                                                     String appName,
                                                     String testName,
                                                     com.applitools.eyes.RectangleSize viewportSize,
                                                     com.applitools.eyes.SessionType sessionType)
        Starts a test.
        Parameters:
        driver - The web driver that controls the browser hosting the application under test.
        appName - The name of the application under test.
        testName - The test name.
        viewportSize - The required browser's viewport size (i.e., the visible part of the document's body) or null to use the current window's viewport.
        sessionType - Should always be SEQUENTIAL
        Returns:
        A wrapped WebDriver which enables Eyes trigger recording and frame handling.
      • getIsOpen

        public boolean getIsOpen()
        Gets is open.
        Specified by:
        getIsOpen in interface com.applitools.eyes.IEyesBase
        Returns:
        Whether a session is open.
      • checkWindow

        public void checkWindow()
      • checkWindow

        public void checkWindow​(String tag)
      • checkWindow

        public void checkWindow​(int matchTimeout,
                                String tag)
      • checkWindow

        public void checkWindow​(String tag,
                                boolean fully)
      • check

        public void check​(String name,
                          com.applitools.ICheckSettings checkSettings)
      • setScrollToRegion

        @Deprecated
        public void setScrollToRegion​(boolean shouldScroll)
        Deprecated.
      • getScrollToRegion

        @Deprecated
        public boolean getScrollToRegion()
        Deprecated.
        Gets scroll to region.
        Returns:
        Whether to automatically scroll to a region being validated.
      • shouldStitchContent

        public boolean shouldStitchContent()
      • getPositionProvider

        public com.applitools.eyes.positioning.PositionProvider getPositionProvider()
        Gets position provider.
        Returns:
        The currently set position provider.
      • setPositionProvider

        public void setPositionProvider​(com.applitools.eyes.positioning.PositionProvider positionProvider)
        Sets position provider.
        Parameters:
        positionProvider - The position provider to be used.
      • setLogHandler

        public void setLogHandler​(com.applitools.eyes.LogHandler logHandler)
        Sets a handler of log messages generated by this API.
        Specified by:
        setLogHandler in interface com.applitools.eyes.IEyesBase
        Parameters:
        logHandler - Handles log messages generated by this API.
      • getLogHandler

        public com.applitools.eyes.LogHandler getLogHandler()
        Gets log handler.
        Specified by:
        getLogHandler in interface com.applitools.eyes.IEyesBase
        Returns:
        The currently set log handler.
      • getLogger

        public com.applitools.eyes.Logger getLogger()
        Gets logger.
        Specified by:
        getLogger in interface com.applitools.eyes.IEyesBase
        Returns:
        the logger
      • addProperty

        public void addProperty​(String name,
                                String value)
        Adds a property to be sent to the server.
        Specified by:
        addProperty in interface com.applitools.eyes.IEyesBase
        Parameters:
        name - The property name.
        value - The property value.
      • clearProperties

        public void clearProperties()
        Clears the list of custom properties.
        Specified by:
        clearProperties in interface com.applitools.eyes.IEyesBase
      • setSaveDebugScreenshots

        public void setSaveDebugScreenshots​(Boolean saveDebugScreenshots)
        Sets save debug screenshots.
        Parameters:
        saveDebugScreenshots - If true, will save all screenshots to local directory.
      • getSaveDebugScreenshots

        public Boolean getSaveDebugScreenshots()
        Gets save debug screenshots.
        Returns:
        True if screenshots saving enabled.
      • getBaseAgentId

        public String getBaseAgentId()
      • getDriver

        public org.openqa.selenium.WebDriver getDriver()
      • getDevicePixelRatio

        public double getDevicePixelRatio()
      • check

        public void check​(com.applitools.ICheckSettings... checkSettings)
      • check

        public void check​(com.applitools.ICheckSettings checkSettings)
      • checkElement

        public void checkElement​(org.openqa.selenium.WebElement element)
      • checkElement

        public void checkElement​(org.openqa.selenium.WebElement element,
                                 String tag)
      • checkElement

        public void checkElement​(org.openqa.selenium.WebElement element,
                                 int matchTimeout,
                                 String tag)
      • checkElement

        public void checkElement​(org.openqa.selenium.By selector)
      • checkElement

        public void checkElement​(org.openqa.selenium.By selector,
                                 String tag)
      • checkElement

        public void checkElement​(org.openqa.selenium.By selector,
                                 int matchTimeout,
                                 String tag)
      • checkRegion

        public void checkRegion​(com.applitools.eyes.Region region)
      • checkRegion

        public void checkRegion​(com.applitools.eyes.Region region,
                                int matchTimeout,
                                String tag)
                         throws com.applitools.eyes.exceptions.TestFailedException
        Throws:
        com.applitools.eyes.exceptions.TestFailedException
      • checkRegion

        public void checkRegion​(org.openqa.selenium.WebElement element)
      • checkRegion

        public void checkRegion​(org.openqa.selenium.WebElement element,
                                String tag,
                                boolean stitchContent)
      • checkRegion

        public void checkRegion​(org.openqa.selenium.WebElement element,
                                int matchTimeout,
                                String tag)
      • checkRegion

        public void checkRegion​(org.openqa.selenium.WebElement element,
                                int matchTimeout,
                                String tag,
                                boolean stitchContent)
      • checkRegion

        public void checkRegion​(org.openqa.selenium.By selector)
      • checkRegion

        public void checkRegion​(org.openqa.selenium.By selector,
                                boolean stitchContent)
      • checkRegion

        public void checkRegion​(org.openqa.selenium.By selector,
                                String tag)
      • checkRegion

        public void checkRegion​(org.openqa.selenium.By selector,
                                String tag,
                                boolean stitchContent)
      • checkRegion

        public void checkRegion​(org.openqa.selenium.By selector,
                                int matchTimeout,
                                String tag)
      • checkRegion

        public void checkRegion​(org.openqa.selenium.By selector,
                                int matchTimeout,
                                String tag,
                                boolean stitchContent)
      • locate

        public Map<String,​List<com.applitools.eyes.Region>> locate​(com.applitools.eyes.locators.VisualLocatorSettings visualLocatorSettings)
      • extractTextRegions

        public Map<String,​List<com.applitools.eyes.locators.TextRegion>> extractTextRegions​(com.applitools.eyes.locators.TextRegionSettings textRegionSettings)
      • extractText

        public List<String> extractText​(com.applitools.eyes.locators.BaseOcrRegion... ocrRegions)
      • close

        public com.applitools.eyes.TestResults close()
        See close(boolean). throwEx defaults to true.
        Returns:
        The test results.
      • close

        public com.applitools.eyes.TestResults close​(boolean shouldThrowException)
        Close test results.
        Parameters:
        shouldThrowException - the should throw exception
        Returns:
        the test results
      • closeAsync

        public void closeAsync()
        Specified by:
        closeAsync in interface com.applitools.eyes.IEyesBase
      • abortIfNotClosed

        public com.applitools.eyes.TestResults abortIfNotClosed()
        If a test is running, aborts it. Otherwise, does nothing.
        Specified by:
        abortIfNotClosed in interface com.applitools.eyes.IEyesBase
      • abort

        public com.applitools.eyes.TestResults abort()
        Specified by:
        abort in interface com.applitools.eyes.IEyesBase
      • abortAsync

        public void abortAsync()
        Specified by:
        abortAsync in interface com.applitools.eyes.IEyesBase
      • getConfigurationInstance

        @Deprecated
        protected com.applitools.eyes.config.Configuration getConfigurationInstance()
        Deprecated.
      • setScaleRatio

        public void setScaleRatio​(Double scaleRatio)
        Manually set the scale ratio for the images being validated.
        Parameters:
        scaleRatio - The scale ratio to use, or null to reset back to automatic scaling.
      • getScaleRatio

        public Double getScaleRatio()
        Gets scale ratio.
        Returns:
        The ratio used to scale the images being validated.