JavaScript
import Mobilerun from '@mobilerun/sdk';
const client = new Mobilerun({
apiKey: process.env['MOBILERUN_CLOUD_API_KEY'], // This is the default and can be omitted
});
const response = await client.devices.state.ui('deviceId');
console.log(response.a11y_tree);import os
from mobilerun_sdk import Mobilerun
client = Mobilerun(
api_key=os.environ.get("MOBILERUN_CLOUD_API_KEY"), # This is the default and can be omitted
)
response = client.devices.state.ui(
device_id="deviceId",
)
print(response.a11y_tree)package main
import (
"context"
"fmt"
"github.com/stainless-sdks/droidrun-cloud-go"
"github.com/stainless-sdks/droidrun-cloud-go/option"
)
func main() {
client := mobileruncloud.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.Devices.State.Ui(
context.TODO(),
"deviceId",
mobileruncloud.DeviceStateUiParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.A11yTree)
}mobilerun-cloud devices:state ui \
--api-key 'My API Key' \
--device-id deviceIdcurl --request GET \
--url https://api.mobilerun.ai/devices/{deviceId}/ui-state \
--header 'Authorization: Bearer <token>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mobilerun.ai/devices/{deviceId}/ui-state",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api.mobilerun.ai/devices/{deviceId}/ui-state")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mobilerun.ai/devices/{deviceId}/ui-state")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"a11y_tree": {
"boundsInScreen": {
"bottom": 123,
"left": 123,
"right": 123,
"top": 123
},
"children": "<array>",
"className": "<string>",
"contentDescription": "<string>",
"isCheckable": true,
"isChecked": true,
"isClickable": true,
"isEnabled": true,
"isFocusable": true,
"isFocused": true,
"isLongClickable": true,
"isPassword": true,
"isScrollable": true,
"isSelected": true,
"packageName": "<string>",
"resourceId": "<string>",
"text": "<string>"
},
"device_context": {
"display_metrics": {
"density": 123,
"densityDpi": 123,
"heightPixels": 123,
"scaledDensity": 123,
"widthPixels": 123
},
"filtering_params": {
"min_element_size": 123,
"overlay_offset": 123
},
"screen_bounds": {
"height": 123,
"width": 123
}
},
"ime_tree": {
"boundsInScreen": {
"bottom": 123,
"left": 123,
"right": 123,
"top": 123
},
"children": "<array>",
"className": "<string>",
"contentDescription": "<string>",
"isCheckable": true,
"isChecked": true,
"isClickable": true,
"isEnabled": true,
"isFocusable": true,
"isFocused": true,
"isLongClickable": true,
"isPassword": true,
"isScrollable": true,
"isSelected": true,
"packageName": "<string>",
"resourceId": "<string>",
"text": "<string>"
},
"phone_state": {
"isEditable": true,
"keyboardVisible": true,
"activityName": "<string>",
"currentApp": "<string>",
"focusedElement": {
"className": "<string>",
"resourceId": "<string>",
"text": "<string>"
},
"packageName": "<string>"
},
"$schema": "<string>"
}{
"$schema": "<string>",
"detail": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
],
"instance": "<string>",
"status": 123,
"title": "<string>",
"type": "about:blank"
}Navigation
UI state
Returns the current accessibility UI state of the device as a structured tree of on-screen elements. An optional filter query reduces the result to interactive elements.
GET
/
devices
/
{deviceId}
/
ui-state
JavaScript
import Mobilerun from '@mobilerun/sdk';
const client = new Mobilerun({
apiKey: process.env['MOBILERUN_CLOUD_API_KEY'], // This is the default and can be omitted
});
const response = await client.devices.state.ui('deviceId');
console.log(response.a11y_tree);import os
from mobilerun_sdk import Mobilerun
client = Mobilerun(
api_key=os.environ.get("MOBILERUN_CLOUD_API_KEY"), # This is the default and can be omitted
)
response = client.devices.state.ui(
device_id="deviceId",
)
print(response.a11y_tree)package main
import (
"context"
"fmt"
"github.com/stainless-sdks/droidrun-cloud-go"
"github.com/stainless-sdks/droidrun-cloud-go/option"
)
func main() {
client := mobileruncloud.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.Devices.State.Ui(
context.TODO(),
"deviceId",
mobileruncloud.DeviceStateUiParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.A11yTree)
}mobilerun-cloud devices:state ui \
--api-key 'My API Key' \
--device-id deviceIdcurl --request GET \
--url https://api.mobilerun.ai/devices/{deviceId}/ui-state \
--header 'Authorization: Bearer <token>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mobilerun.ai/devices/{deviceId}/ui-state",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api.mobilerun.ai/devices/{deviceId}/ui-state")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mobilerun.ai/devices/{deviceId}/ui-state")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"a11y_tree": {
"boundsInScreen": {
"bottom": 123,
"left": 123,
"right": 123,
"top": 123
},
"children": "<array>",
"className": "<string>",
"contentDescription": "<string>",
"isCheckable": true,
"isChecked": true,
"isClickable": true,
"isEnabled": true,
"isFocusable": true,
"isFocused": true,
"isLongClickable": true,
"isPassword": true,
"isScrollable": true,
"isSelected": true,
"packageName": "<string>",
"resourceId": "<string>",
"text": "<string>"
},
"device_context": {
"display_metrics": {
"density": 123,
"densityDpi": 123,
"heightPixels": 123,
"scaledDensity": 123,
"widthPixels": 123
},
"filtering_params": {
"min_element_size": 123,
"overlay_offset": 123
},
"screen_bounds": {
"height": 123,
"width": 123
}
},
"ime_tree": {
"boundsInScreen": {
"bottom": 123,
"left": 123,
"right": 123,
"top": 123
},
"children": "<array>",
"className": "<string>",
"contentDescription": "<string>",
"isCheckable": true,
"isChecked": true,
"isClickable": true,
"isEnabled": true,
"isFocusable": true,
"isFocused": true,
"isLongClickable": true,
"isPassword": true,
"isScrollable": true,
"isSelected": true,
"packageName": "<string>",
"resourceId": "<string>",
"text": "<string>"
},
"phone_state": {
"isEditable": true,
"keyboardVisible": true,
"activityName": "<string>",
"currentApp": "<string>",
"focusedElement": {
"className": "<string>",
"resourceId": "<string>",
"text": "<string>"
},
"packageName": "<string>"
},
"$schema": "<string>"
}{
"$schema": "<string>",
"detail": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
],
"instance": "<string>",
"status": 123,
"title": "<string>",
"type": "about:blank"
}Alongside the main
a11y_tree, the response carries a separate ime_tree for the on-screen keyboard window, phone_state (foreground app, focused element, keyboard visibility), and device_context (screen bounds, display density).
Element
boundsInScreen values are in the same pixel space the tap and swipe endpoints use — read an element’s bounds and tap the center of its box for element-driven automation.Authorizations
Bearer token via Authorization header
Headers
Required range:
x >= 0Path Parameters
Query Parameters
Response
OK
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
A URL to the JSON Schema for this object.
Example:
"https://example.com/schemas/AndroidState.json"
Was this page helpful?
⌘I