Description
The command enables you to capture a screenshot of a part of the device’s screen in a given time and create a new element in zone "runtime" that you can use in later steps of your scripts.
Parameters
Name | Value | Description |
---|---|---|
name | String | Name that will be given to the captured Element |
X | Integer | First point X |
Y | Integer | First point Y |
Width | Integer | Width of the captured area |
Height | Integer | Height of the captured area |
Similarity | Integer | Integer number between 80-100. Enables to define the tolerance of changes when searching for the image. |
Usage
Designed command for image recognition during runtime.
This can be highly useful when the elements on the screen changes very often or for image comparisons. Once the image is captured, it can be then clicked using click command.
Set Experitest Url
Please make sure you replace <EXPERITEST_URL> with appropriate URL in the code snippet below.
- For SeeTest cloud, EXPERITEST_URL needs to be https://cloud.seetest.io:443/wd/hub
- For Dedicated Experitest Lab, EXPERITEST_URL needs to be your own domain. e.g - https://company.experitest.com
Example
In the following example we capture the Calendar Element.
CaptureElement
DesiredCapabilities dc = new DesiredCapabilities(); driver = new AndroidDriver(new URL("<EXPERITEST_URL>"), 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)