public class SeleniumEyes extends com.applitools.eyes.EyesBase implements ISeleniumEyes, com.applitools.eyes.IBatchCloser
Modifier and Type | Class and Description |
---|---|
static interface |
SeleniumEyes.WebDriverAction
The interface Web driver action.
|
Modifier and Type | Field and Description |
---|---|
boolean |
checkFrameOrElement |
static double |
DEFAULT_DEVICE_PIXEL_RATIO
The constant DEFAULT_DEVICE_PIXEL_RATIO.
|
static double |
UNKNOWN_DEVICE_PIXEL_RATIO
The constant UNKNOWN_DEVICE_PIXEL_RATIO.
|
Constructor and Description |
---|
SeleniumEyes(com.applitools.eyes.config.ConfigurationProvider configurationProvider,
ClassicRunner runner)
Creates a new SeleniumEyes instance that interacts with the SeleniumEyes cloud
service.
|
Modifier and Type | Method and Description |
---|---|
void |
addMouseTrigger(com.applitools.eyes.triggers.MouseAction action,
com.applitools.eyes.Region control,
com.applitools.eyes.Location cursor)
Adds a mouse trigger.
|
void |
addMouseTrigger(com.applitools.eyes.triggers.MouseAction action,
org.openqa.selenium.WebElement element)
Adds a mouse trigger.
|
void |
addTextTrigger(com.applitools.eyes.Region control,
String text)
Adds a keyboard trigger.
|
void |
addTextTrigger(org.openqa.selenium.WebElement element,
String text)
Adds a keyboard trigger.
|
void |
apiKey(String apiKey) |
void |
check(com.applitools.ICheckSettings... checkSettings)
Takes multiple screenshots at once (given all
ICheckSettings objects are on the same level). |
void |
check(com.applitools.ICheckSettings checkSettings) |
void |
check(String name,
com.applitools.ICheckSettings checkSettings)
Check.
|
protected void |
checkCurrentFrame(int matchTimeout,
String tag,
String source)
Verifies the current frame.
|
void |
checkElement(org.openqa.selenium.By selector)
|
void |
checkElement(org.openqa.selenium.By selector,
int matchTimeout,
String tag)
Takes a snapshot of the application under test and matches an element
specified by the given selector with the expected region output.
|
void |
checkElement(org.openqa.selenium.By selector,
String tag)
|
void |
checkElement(org.openqa.selenium.WebElement element,
int matchTimeout,
String tag)
Takes a snapshot of the application under test and matches a specific
element with the expected region output.
|
void |
checkFrame(int frameIndex)
|
void |
checkFrame(int frameIndex,
int matchTimeout,
String tag)
Matches the frame given as parameter, by switching into the frame and
using stitching to get an image of the frame.
|
void |
checkFrame(int frameIndex,
String tag)
|
void |
checkFrame(String frameNameOrId)
|
void |
checkFrame(String[] framePath,
int matchTimeout,
String tag)
Matches the frame given by the frames path, by switching into the frame
and using stitching to get an image of the frame.
|
void |
checkFrame(String frameNameOrId,
int matchTimeout,
String tag)
Matches the frame given as parameter, by switching into the frame and
using stitching to get an image of the frame.
|
void |
checkFrame(String frameNameOrId,
String tag)
|
void |
checkFrame(org.openqa.selenium.WebElement frameReference)
|
void |
checkFrame(org.openqa.selenium.WebElement frameReference,
int matchTimeout,
String tag)
Matches the frame given as parameter, by switching into the frame and
using stitching to get an image of the frame.
|
void |
checkFrame(org.openqa.selenium.WebElement frameReference,
String tag)
|
void |
checkRegionInFrame(String[] framePath,
org.openqa.selenium.By selector,
int matchTimeout,
String tag,
boolean stitchContent)
Switches into the given frame, takes a snapshot of the application under
test and matches a region specified by the given selector.
|
void |
checkWindow()
See
checkWindow(String) . |
void |
checkWindow(int matchTimeout,
String tag)
Takes a snapshot of the application under test and matches it with
the expected output.
|
void |
checkWindow(String tag)
|
com.applitools.eyes.TestResults |
close(boolean throwEx) |
void |
closeBatch(String batchId) |
Object |
getAgentSetup() |
protected com.applitools.eyes.AppEnvironment |
getAppEnvironment() |
protected String |
getAUTSessionId() |
String |
getBaseAgentId() |
protected com.applitools.eyes.config.Configuration |
getConfigurationInstance() |
com.applitools.eyes.positioning.PositionProvider |
getCurrentFramePositionProvider()
Gets current frame position provider.
|
org.openqa.selenium.WebElement |
getCurrentFrameScrollRootElement()
Gets current frame scroll root element.
|
com.applitools.eyes.CutProvider |
getCutProvider() |
double |
getDevicePixelRatio() |
org.openqa.selenium.WebDriver |
getDriver()
Gets driver.
|
protected String |
getInferredEnvironment() |
FrameChain |
getOriginalFC()
Gets original fc.
|
static com.applitools.eyes.positioning.PositionProvider |
getPositionProviderForScrollRootElement(com.applitools.eyes.Logger logger,
EyesSeleniumDriver driver,
StitchMode stitchMode,
com.applitools.eyes.UserAgent ua,
org.openqa.selenium.WebElement scrollRootElement) |
com.applitools.eyes.Region |
getRegionToCheck()
Gets region to check.
|
ImageRotation |
getRotation()
Gets rotation.
|
com.applitools.eyes.ScaleProvider |
getScaleProvider()
Gets scale provider.
|
protected com.applitools.eyes.EyesScreenshot |
getScreenshot(com.applitools.eyes.Region targetRegion,
com.applitools.eyes.fluent.ICheckSettingsInternal checkSettingsInternal) |
org.openqa.selenium.WebElement |
getScrollRootElement()
Gets scroll root element.
|
static org.openqa.selenium.WebElement |
getScrollRootElementFromSREContainer(com.applitools.eyes.Logger logger,
IScrollRootElementContainer scrollRootElementContainer,
EyesSeleniumDriver driver) |
boolean |
getScrollToRegion()
Gets scroll to region.
|
protected String |
getTitle() |
com.applitools.eyes.UserAgent |
getUserAgent() |
com.applitools.eyes.RectangleSize |
getViewportSize()
Use this method only if you made a previous call to
(WebDriver, String, String) or one of its variants. |
Boolean |
isSendDom() |
org.openqa.selenium.WebDriver |
open(org.openqa.selenium.WebDriver driver)
Open web driver.
|
org.openqa.selenium.WebDriver |
open(org.openqa.selenium.WebDriver driver,
String appName,
String testName,
com.applitools.eyes.RectangleSize viewportSize) |
void |
serverUrl(String serverUrl) |
void |
serverUrl(URI serverUrl) |
protected void |
setEffectiveViewportSize(com.applitools.eyes.RectangleSize size) |
void |
setIsDisabled(boolean disabled) |
void |
setIsDisabled(Boolean disabled) |
void |
setRegionToCheck(com.applitools.eyes.Region regionToCheck)
Sets region to check.
|
void |
setRotation(ImageRotation rotation)
Sets rotation.
|
void |
setScrollToRegion(boolean shouldScroll)
Turns on/off the automatic scrolling to a region being checked by
checkRegion . |
protected com.applitools.eyes.config.Configuration |
setViewportSize(com.applitools.eyes.RectangleSize size)
Use this method only if you made a previous call to
(WebDriver, String, String) or one of its variants. |
boolean |
shouldStitchContent()
Should stitch content boolean.
|
String |
tryCaptureDom() |
static org.openqa.selenium.WebElement |
tryGetUserDefinedSREFromSREContainer(IScrollRootElementContainer scrollRootElementContainer,
EyesSeleniumDriver driver) |
protected com.applitools.eyes.ScaleProviderFactory |
updateScalingParams()
Updates the state of scaling related parameters.
|
abort, abortAsync, abortIfNotClosed, abortIfNotClosed, addMouseTriggerBase, addProperty, addProperty, addSessionEventHandler, addTextTriggerBase, addUserInput, checkWindowBase, checkWindowBase, checkWindowBase, checkWindowBase, checkWindowBase, clearProperties, clearSessionEventHandlers, clearUserInputs, close, close, closeLogger, ensureRunningSession, fireValidationWillStartEvent, getApiKey, getAppName, getBaselineEnvName, getConfiguration, getDebugScreenshotsPath, getDebugScreenshotsPrefix, getDebugScreenshotsProvider, getDefaultServerUrl, getDevicesSizes, getFullAgentId, getIsCutProviderExplicitlySet, getIsDisabled, getIsOpen, getIsScaleProviderExplicitlySet, getLogger, getLogHandler, getMobileDeviceInfo, getPositionProvider, getProxy, getRenderingInfo, getSaveDebugScreenshots, getScaleRatio, getServerConnector, getServerUrl, getSessionEventHandlers, getTestName, getUserAgents, getUserInputs, getViewportSizeForOpen, log, logSessionResultsAndThrowException, openBase, openBaseAsync, openLogger, removeSessionEventHandler, setApiKey, setBatch, setDebugScreenshotsPath, setDebugScreenshotsPrefix, setExplicitViewportSize, setImageCut, setLogHandler, setPositionProvider, setProxy, setSaveDebugScreenshots, setScaleRatio, setSendDom, setServerConnector, setServerUrl, setServerUrl, startSession, tryCaptureAndPostDom
public static final double UNKNOWN_DEVICE_PIXEL_RATIO
public static final double DEFAULT_DEVICE_PIXEL_RATIO
public boolean checkFrameOrElement
public SeleniumEyes(com.applitools.eyes.config.ConfigurationProvider configurationProvider, ClassicRunner runner)
@Obsolete public boolean shouldStitchContent()
public String getBaseAgentId()
getBaseAgentId
in class com.applitools.eyes.EyesBase
public void apiKey(String apiKey)
apiKey
in interface ISeleniumEyes
public void serverUrl(String serverUrl)
serverUrl
in interface ISeleniumEyes
public void serverUrl(URI serverUrl)
public org.openqa.selenium.WebDriver getDriver()
getDriver
in interface ISeleniumEyes
public FrameChain getOriginalFC()
public com.applitools.eyes.positioning.PositionProvider getCurrentFramePositionProvider()
public com.applitools.eyes.Region getRegionToCheck()
public void setRegionToCheck(com.applitools.eyes.Region regionToCheck)
regionToCheck
- the region to checkpublic void setScrollToRegion(boolean shouldScroll)
checkRegion
.shouldScroll
- Whether to automatically scroll to a region being validated.public boolean getScrollToRegion()
public ImageRotation getRotation()
public void setRotation(ImageRotation rotation)
rotation
- The image rotation model.public double getDevicePixelRatio()
UNKNOWN_DEVICE_PIXEL_RATIO
if the DPR is not known yet or if it wasn't possible to extract it.public org.openqa.selenium.WebDriver open(org.openqa.selenium.WebDriver driver, String appName, String testName, com.applitools.eyes.RectangleSize viewportSize) throws com.applitools.eyes.EyesException
open
in interface ISeleniumEyes
com.applitools.eyes.EyesException
public org.openqa.selenium.WebDriver open(org.openqa.selenium.WebDriver driver) throws com.applitools.eyes.EyesException
open
in interface ISeleniumEyes
driver
- the drivercom.applitools.eyes.EyesException
- the eyes exceptionpublic org.openqa.selenium.WebElement getScrollRootElement()
public void checkWindow()
public void checkWindow(String tag)
checkWindow(int, String)
.
Default match timeout is used.tag
- An optional tag to be associated with the snapshot.public void checkWindow(int matchTimeout, String tag)
matchTimeout
- The amount of time to retry matching (Milliseconds).tag
- An optional tag to be associated with the snapshot.com.applitools.eyes.exceptions.TestFailedException
- Thrown if a mismatch is detected and
immediate failure reports are enabled.public void check(com.applitools.ICheckSettings... checkSettings)
ICheckSettings
objects are on the same level).public void check(String name, com.applitools.ICheckSettings checkSettings)
public void setIsDisabled(boolean disabled)
setIsDisabled
in class com.applitools.eyes.EyesBase
public String tryCaptureDom()
tryCaptureDom
in class com.applitools.eyes.EyesBase
protected void setEffectiveViewportSize(com.applitools.eyes.RectangleSize size)
setEffectiveViewportSize
in class com.applitools.eyes.EyesBase
public void check(com.applitools.ICheckSettings checkSettings)
public static org.openqa.selenium.WebElement tryGetUserDefinedSREFromSREContainer(IScrollRootElementContainer scrollRootElementContainer, EyesSeleniumDriver driver)
public static org.openqa.selenium.WebElement getScrollRootElementFromSREContainer(com.applitools.eyes.Logger logger, IScrollRootElementContainer scrollRootElementContainer, EyesSeleniumDriver driver)
public static com.applitools.eyes.positioning.PositionProvider getPositionProviderForScrollRootElement(com.applitools.eyes.Logger logger, EyesSeleniumDriver driver, StitchMode stitchMode, com.applitools.eyes.UserAgent ua, org.openqa.selenium.WebElement scrollRootElement)
public void closeBatch(String batchId)
closeBatch
in interface com.applitools.eyes.IBatchCloser
protected com.applitools.eyes.ScaleProviderFactory updateScalingParams()
public org.openqa.selenium.WebElement getCurrentFrameScrollRootElement()
protected void checkCurrentFrame(int matchTimeout, String tag, String source)
matchTimeout
- The amount of time to retry matching. (Milliseconds)tag
- An optional tag to be associated with the snapshot.public void checkFrame(String frameNameOrId)
frameNameOrId
- the frame name or idpublic void checkFrame(String frameNameOrId, String tag)
checkFrame(String, int, String)
.
Default match timeout is used.frameNameOrId
- the frame name or idtag
- the tagpublic void checkFrame(String frameNameOrId, int matchTimeout, String tag)
frameNameOrId
- The name or id of the frame to check. (The same name/id as would be used in a call to driver.switchTo().frame()).matchTimeout
- The amount of time to retry matching. (Milliseconds)tag
- An optional tag to be associated with the match.public void checkFrame(int frameIndex)
frameIndex
- the frame indexpublic void checkFrame(int frameIndex, String tag)
checkFrame(int, int, String)
.
Default match timeout is used.frameIndex
- the frame indextag
- the tagpublic void checkFrame(int frameIndex, int matchTimeout, String tag)
frameIndex
- The index of the frame to switch to. (The same index as would be used in a call to driver.switchTo().frame()).matchTimeout
- The amount of time to retry matching. (Milliseconds)tag
- An optional tag to be associated with the match.public void checkFrame(org.openqa.selenium.WebElement frameReference)
frameReference
- the frame referencepublic void checkFrame(org.openqa.selenium.WebElement frameReference, String tag)
checkFrame(WebElement, int, String)
.
Default match timeout is used.frameReference
- the frame referencetag
- the tagpublic void checkFrame(org.openqa.selenium.WebElement frameReference, int matchTimeout, String tag)
frameReference
- The element which is the frame to switch to. (as would be used in a call to driver.switchTo().frame() ).matchTimeout
- The amount of time to retry matching (milliseconds).tag
- An optional tag to be associated with the match.public void checkFrame(String[] framePath, int matchTimeout, String tag)
framePath
- The path to the frame to check. This is a list of frame names/IDs (where each frame is nested in the previous frame).matchTimeout
- The amount of time to retry matching (milliseconds).tag
- An optional tag to be associated with the match.public void checkRegionInFrame(String[] framePath, org.openqa.selenium.By selector, int matchTimeout, String tag, boolean stitchContent)
framePath
- The path to the frame to check. This is a list of
frame names/IDs (where each frame is nested in the previous frame).selector
- A Selector specifying the region to check.matchTimeout
- The amount of time to retry matching (milliseconds).tag
- An optional tag to be associated with the snapshot.stitchContent
- Whether or not to stitch the internal content of the
region (i.e., perform checkElement(By, int, String)
on the region.public void checkElement(org.openqa.selenium.WebElement element, int matchTimeout, String tag)
element
- The element to check.matchTimeout
- The amount of time to retry matching. (Milliseconds)tag
- An optional tag to be associated with the snapshot.com.applitools.eyes.exceptions.TestFailedException
- if a mismatch is detected and immediate failure reports are enabledpublic void checkElement(org.openqa.selenium.By selector)
selector
- the selectorpublic void checkElement(org.openqa.selenium.By selector, String tag)
checkElement(By, int, String)
.
Default match timeout is used.selector
- the selectortag
- the tagpublic void checkElement(org.openqa.selenium.By selector, int matchTimeout, String tag)
selector
- Selects the element to check.matchTimeout
- The amount of time to retry matching. (Milliseconds)tag
- An optional tag to be associated with the screenshot.com.applitools.eyes.exceptions.TestFailedException
- if a mismatch is detected and immediate failure reports are enabledpublic void addMouseTrigger(com.applitools.eyes.triggers.MouseAction action, com.applitools.eyes.Region control, com.applitools.eyes.Location cursor)
action
- Mouse action.control
- The control on which the trigger is activated (context relative coordinates).cursor
- The cursor's position relative to the control.public void addMouseTrigger(com.applitools.eyes.triggers.MouseAction action, org.openqa.selenium.WebElement element)
action
- Mouse action.element
- The WebElement on which the click was called.public void addTextTrigger(com.applitools.eyes.Region control, String text)
control
- The control's context-relative region.text
- The trigger's text.public void addTextTrigger(org.openqa.selenium.WebElement element, String text)
element
- The element for which we sent keys.text
- The trigger's text.public com.applitools.eyes.RectangleSize getViewportSize()
(WebDriver, String, String)
or one of its variants.
getViewportSize
in class com.applitools.eyes.EyesBase
protected com.applitools.eyes.config.Configuration setViewportSize(com.applitools.eyes.RectangleSize size)
(WebDriver, String, String)
or one of its variants.
setViewportSize
in class com.applitools.eyes.EyesBase
protected com.applitools.eyes.EyesScreenshot getScreenshot(com.applitools.eyes.Region targetRegion, com.applitools.eyes.fluent.ICheckSettingsInternal checkSettingsInternal)
getScreenshot
in class com.applitools.eyes.EyesBase
protected String getTitle()
getTitle
in class com.applitools.eyes.EyesBase
protected String getInferredEnvironment()
getInferredEnvironment
in class com.applitools.eyes.EyesBase
protected com.applitools.eyes.AppEnvironment getAppEnvironment()
This override also checks for mobile operating system.
getAppEnvironment
in class com.applitools.eyes.EyesBase
public void setIsDisabled(Boolean disabled)
setIsDisabled
in interface com.applitools.eyes.IEyesBase
setIsDisabled
in class com.applitools.eyes.EyesBase
protected String getAUTSessionId()
getAUTSessionId
in class com.applitools.eyes.EyesBase
public com.applitools.eyes.TestResults close(boolean throwEx)
close
in interface ISeleniumEyes
close
in class com.applitools.eyes.EyesBase
public Object getAgentSetup()
getAgentSetup
in class com.applitools.eyes.EyesBase
public Boolean isSendDom()
isSendDom
in class com.applitools.eyes.EyesBase
protected com.applitools.eyes.config.Configuration getConfigurationInstance()
getConfigurationInstance
in class com.applitools.eyes.EyesBase
public com.applitools.eyes.UserAgent getUserAgent()
public com.applitools.eyes.ScaleProvider getScaleProvider()
public com.applitools.eyes.CutProvider getCutProvider()
Copyright © 2020. All rights reserved.