Skip to main content

CaptureElement

Description

Use this command to capture a screenshot of a part of the device’s screen in a given time and create a new element in the zone runtime that you can use in later steps of your scripts. This can be highly useful when the elements on the screen change often or for image comparisons. Once the image is captured, it can be then clicked using click.

Parameters

NameValueDescription
nameStringName that will be given to the captured Element
XIntegerFirst point X
YIntegerFirst point Y
WidthIntegerWidth of the captured area
HeightIntegerHeight of the captured area
SimilarityIntegerInteger number between 80-100. Enables to define the tolerance of changes when searching for the image.

Usage

info

Replace <server> with the appropriate URL.

Example

In the following example we capture the Calendar Element.

**

**

CaptureElement

DesiredCapabilities dc = new DesiredCapabilities();
driver = new AndroidDriver(new URL("<server>"), dc);
seetest = new SeeTestClient(driver);
dc.setCapability(MobileCapabilityType.UDID, "deviceid");

...
...

//Get the current foreground activity
seetest.captureElement("Calendar", 275, 255, 264, 299, 100)
seetest.click("runtime", "Calendar", 0, 1)