Legacy | Application.Element.Find
-
Command: application.element
-
Subcommand: find
-
Supported Platforms: Native (legacy), Selenium, Appium
All commands must be executed using the same framework. Sharing the execution ID between different frameworks is not possible. This means that if you work with a Selenium/Appium driver, you need to call the commands using the Selenium/Appium driver (or, in the case of Reporting commands, through the Reporting SDK that works with the driver) and not as part of a UFT test or another framework.
-
Supported OS: Android, iOS
Description
Finds an element or elements in the active application. Can be used to validate whether an element exists in the application.
The returnValue of the response will indicate the UI Element hierarchy to the found element.
Parameters
Name | Value | Default | Description |
---|---|---|---|
deviceId* | The device for this command. | ||
value* |
The object identifier. By default, an Xpath is generated by the object spy. Use the By parameter to specify another identification method. |
||
by |
xpath (XPath) className (Class) linkText (Text) partialLinkText (Partial text) name (Name) id (Id) accessibilityId (Accessibility id) uiAutomator (UIAutomator Selector) uiAutomation (UIAutomation Selector) cacheId (Class Chain) predicate () classChain () |
XPath |
Specifies the identification method. |
timeout |
0 |
The time, in seconds, to wait for the element to appear on the screen or the web page. |
|
datatable |
The results of the find will be added to a data table, which can be used with other functions. The data table should have a single column of type STRING. |
||
framework |
appium-1.3.4 (Appium) perfectoMobile (PerfectoMobile) |
PerfectoMobile |
The automation framework (by default PerfectoMobile). |
report |
screenshot (Screenshot) screenshot-on-error (Screenshot on error) none (None) |
Screenshot |
The value to display in the report. Screenshot - display screenshot Screenshot on error - display screenshots only for actions in error None - display nothing Consider reducing the resolution in very long scripts that result in large report files. |
report.resolution |
high (High) medium (Medium) low (Low) |
High |
The image resolution. Consider reducing the resolution in very long scripts that result in large report files. |
* Mandatory
Request & Response
Request
https://mycloud.perfectomobile.com/services/executions/john@perfectomobile.com_controller_16-12-08_08_14_17_415?operation=command&securityToken=<your_token>&command=application.element&subcommand=find¶m.deviceId=04157DF47CA01828¶m.by=id¶m.value=com.google.android.keep:id/new_list_button¶m.framework=appium-1.3.4
JSON response
{
"reason":"Success",
"timer.elapsed":"860",
"returnValue":"[//hierarchy/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.FrameLayout[1]/android.widget.FrameLayout[1]/android.support.v4.widget.DrawerLayout[1]/android.widget.FrameLayout[1]/android.widget.FrameLayout[8]/android.widget.LinearLayout[1]/android.widget.ImageView[1]]",
"testGridReportUrl":"https://mycloud.reporting-stg.perfectomobile.com?externalId[0]=john@perfectomobile.com_controller_16-12-08_08_14_17_415",
"description":"Success",
"timer.system":"31",
"completed":"true",
"flowEndCode":"SUCCEEDED",
"executionId":"john@perfectomobile.com_controller_16-12-08_08_14_17_415",
"timer.ux":"829",
"singleTestReportUrl":"https://mycloud.perfectomobile.com/nexperience/singletest/report/?reportRepositoryKey=PRIVATE:controller/161208/controller_16-12-08_08_14_17_415.xml&ownerId=john@perfectomobile.com&sharingCode=a29ae726-7600-44b3-b56e-2b48313f1301",
"reportKey":"PRIVATE:controller/161208/controller_16-12-08_08_14_17_415.xml",
"scopes":"0",
"timer.device":"829"}