public class EyesDriverUtils extends Object
| Constructor and Description |
|---|
EyesDriverUtils() |
| Modifier and Type | Method and Description |
|---|---|
static RectangleSize |
getCurrentFrameContentEntireSize(IEyesJsExecutor executor)
Gets current frame content entire size.
|
static Location |
getCurrentScrollPosition(IEyesJsExecutor executor)
Gets current scroll position.
|
static Map<String,String> |
getCurrentTransform(IEyesJsExecutor executor)
Gets current transform.
|
static RectangleSize |
getElementVisibleSize(Logger logger,
org.openqa.selenium.WebElement element)
Returns given element visible portion size.\
|
static RectangleSize |
getEntireElementSize(Logger logger,
IEyesJsExecutor executor,
org.openqa.selenium.WebElement element)
Gets entire element size.
|
static String |
getMobileDeviceName(org.openqa.selenium.HasCapabilities driver) |
static Location |
getPageLocation(org.openqa.selenium.interactions.Coordinates coordinates)
Extracts the location relative to the entire page from the coordinates
(e.g.
|
static String |
getPlatformVersion(org.openqa.selenium.HasCapabilities driver) |
static org.openqa.selenium.WebDriver |
getUnderlyingDriver(org.openqa.selenium.WebDriver driver)
For EyesWebDriver instances, returns the underlying WebDriver.
|
static Location |
getViewportLocation(org.openqa.selenium.interactions.Coordinates coordinates)
Extracts the location relative to the viewport from the
coordinates (e.g.
|
static RectangleSize |
getViewportSize(org.openqa.selenium.JavascriptExecutor executor)
Gets viewport size.
|
static RectangleSize |
getViewportSizeOrDisplaySize(Logger logger,
org.openqa.selenium.WebDriver driver)
Gets viewport size or display size.
|
static org.openqa.selenium.Rectangle |
getVisibleElementRect(org.openqa.selenium.WebElement webElement,
EyesWebDriver driver) |
static org.openqa.selenium.WebElement |
getWrappedWebElement(org.openqa.selenium.WebElement webElement)
If the web element was created by
FindBy, then it's a Proxy object. |
static boolean |
isAndroid(org.openqa.selenium.WebDriver driver)
Is android boolean.
|
static boolean |
isIOS(org.openqa.selenium.WebDriver driver)
Is ios boolean.
|
static boolean |
isLandscapeOrientation(Logger logger,
org.openqa.selenium.WebDriver driver)
Is landscape orientation boolean.
|
static boolean |
isMobileDevice(org.openqa.selenium.WebDriver driver) |
static boolean |
isMobileDeviceByContext(org.openqa.selenium.WebDriver driver) |
static Location |
parseLocationString(Object position) |
static String |
selectRootElement(org.openqa.selenium.JavascriptExecutor executor)
Select root element string.
|
static boolean |
setBrowserSize(org.openqa.selenium.WebDriver driver,
RectangleSize requiredSize)
Sets browser size.
|
static boolean |
setBrowserSizeByViewportSize(org.openqa.selenium.WebDriver driver,
RectangleSize actualViewportSize,
RectangleSize requiredViewportSize)
Sets browser size by viewport size.
|
static void |
setCurrentScrollPosition(IEyesJsExecutor executor,
Location location)
Sets the scroll position of the current frame.
|
static String |
setOverflow(org.openqa.selenium.JavascriptExecutor executor,
String value,
org.openqa.selenium.WebElement rootElement)
Sets the overflow of the current context's body.
|
static void |
setTransform(IEyesJsExecutor executor,
String transform)
Set the given transform to document.documentElement for all style keys
defined in
JS_TRANSFORM_KEYS . |
static void |
setTransforms(IEyesJsExecutor executor,
Map<String,String> transforms)
Sets transforms for document.documentElement according to the given
map of style keys and values.
|
static void |
setViewportSize(Logger logger,
org.openqa.selenium.WebDriver driver,
RectangleSize size)
Sets viewport size.
|
static void |
translateTo(IEyesJsExecutor executor,
Location position)
Translates the current documentElement to the given position.
|
public static Location getPageLocation(org.openqa.selenium.interactions.Coordinates coordinates)
coordinates - The coordinates from which location is extracted.public static Location getViewportLocation(org.openqa.selenium.interactions.Coordinates coordinates)
coordinates - The coordinates from which location is extracted.public static org.openqa.selenium.WebDriver getUnderlyingDriver(org.openqa.selenium.WebDriver driver)
driver - The driver instance for which to get the underlying WebDriver.public static boolean isMobileDevice(org.openqa.selenium.WebDriver driver)
driver - The driver for which to check if it represents a mobile
device.true if the platform running the test is a mobile
platform. false otherwise.public static boolean isMobileDeviceByContext(org.openqa.selenium.WebDriver driver)
public static boolean isLandscapeOrientation(Logger logger, org.openqa.selenium.WebDriver driver)
logger - the loggerdriver - The driver for which to check the orientation.true if this is a mobile device and is in landscape orientation. false otherwise.public static String selectRootElement(org.openqa.selenium.JavascriptExecutor executor)
executor - the executorpublic static String setOverflow(org.openqa.selenium.JavascriptExecutor executor, String value, org.openqa.selenium.WebElement rootElement)
executor - The executor to use for setting the overflow.value - The overflow value to set.rootElement - the root elementnull if undefined).public static Location getCurrentScrollPosition(IEyesJsExecutor executor)
executor - The executor to use.public static void setCurrentScrollPosition(IEyesJsExecutor executor, Location location)
executor - The executor to use.location - The position to be set.public static RectangleSize getCurrentFrameContentEntireSize(IEyesJsExecutor executor)
executor - The executor to use.public static RectangleSize getEntireElementSize(Logger logger, IEyesJsExecutor executor, org.openqa.selenium.WebElement element)
logger - the loggerexecutor - the executorelement - the elementpublic static RectangleSize getViewportSize(org.openqa.selenium.JavascriptExecutor executor)
executor - The executor to use.public static RectangleSize getViewportSizeOrDisplaySize(Logger logger, org.openqa.selenium.WebDriver driver)
logger - The logger to use.driver - The web driver to use.public static boolean setBrowserSize(org.openqa.selenium.WebDriver driver,
RectangleSize requiredSize)
driver - the driverrequiredSize - the required sizepublic static boolean setBrowserSizeByViewportSize(org.openqa.selenium.WebDriver driver,
RectangleSize actualViewportSize,
RectangleSize requiredViewportSize)
driver - the driveractualViewportSize - the actual viewport sizerequiredViewportSize - the required viewport sizepublic static void setViewportSize(Logger logger, org.openqa.selenium.WebDriver driver, RectangleSize size)
logger - The logger to use.driver - The web driver to use.size - The size to set as the viewport size.public static boolean isAndroid(org.openqa.selenium.WebDriver driver)
driver - The driver to test.true if the driver is an Android driver. false otherwise.public static boolean isIOS(org.openqa.selenium.WebDriver driver)
driver - The driver to test.true if the driver is an iOS driver. false otherwise.public static String getPlatformVersion(org.openqa.selenium.HasCapabilities driver)
driver - The driver to get the platform version from.null if it is undefined.public static String getMobileDeviceName(org.openqa.selenium.HasCapabilities driver)
driver - The driver to get the platform version from.public static Map<String,String> getCurrentTransform(IEyesJsExecutor executor)
executor - The executor to use.JS_TRANSFORM_KEYS.public static void setTransforms(IEyesJsExecutor executor, Map<String,String> transforms)
executor - The executor to use.transforms - The transforms to set. Keys are used as style keys, and values are the values for those styles.public static void setTransform(IEyesJsExecutor executor, String transform)
JS_TRANSFORM_KEYS .executor - The executor to use.transform - The transform value to set.public static RectangleSize getElementVisibleSize(Logger logger, org.openqa.selenium.WebElement element)
element - The element for which to return the size.public static void translateTo(IEyesJsExecutor executor, Location position)
executor - The executor to use.position - The position to translate to.public static org.openqa.selenium.WebElement getWrappedWebElement(org.openqa.selenium.WebElement webElement)
FindBy, then it's a Proxy object.
This method gets the real web element from the proxy object.public static org.openqa.selenium.Rectangle getVisibleElementRect(org.openqa.selenium.WebElement webElement,
EyesWebDriver driver)
Copyright © 2021. All rights reserved.