AltObject#

An AltObject is an object of your app that AltTester® found: a GameObject or, in the Non-GPL package, a UI Toolkit visual element. FindObject and the other find and wait commands return it. Its fields describe the object as it was when it was found; its methods read and change the object in the app, and act on it.

The examples assume an AltObject found with FindObject, in altObject (Python: alt_object). In Robot Framework the methods are keywords that take the object as their first argument.

Each command shows its signature and an example in every language; pick a language in any tab and the others switch with it.

Commands on this page#

Command

What it does

FindObjectFromObject

Finds the first object below this one, at any depth, that matches the criteria.

GetParent

Returns the object’s parent.

UpdateObject

Reads the object’s fields again from the app, such as its position after it moved.

GetScreenPosition

Returns the object’s position on the screen, in pixels from the bottom-left corner.

GetWorldPosition

Returns the object’s position in the scene.

GetText

Returns the text of a UI Text, InputField, or TextMeshPro text or input field.

SetText

Sets the text of a UI Text, InputField, or TextMeshPro text or input field.

GetComponentProperty

Returns the value of a field or property of a component on the object.

WaitForComponentProperty

Waits until a field or property of a component on the object has a value, and returns it.

SetComponentProperty

Sets a field or property of a component on the object.

CallComponentMethod

Calls a public method of a component on the object, and returns what it returns.

Tap

Taps the object, once or several times.

Click

Clicks the object with the mouse, once or several times.

PointerDown

Sends the object a pointer down event, as when a mouse button or finger is pressed on it.

PointerUp

Sends the object a pointer up event, as when a mouse button or finger is released over it.

PointerEnter

Sends the object a pointer enter event, as when the mouse moves over it.

PointerExit

Sends the object a pointer exit event, as when the mouse moves off it.

GetVisualElementProperty

Non-GPL Returns the value of a property of a visual element.

WaitForVisualElementProperty

Non-GPL Waits until a property of a visual element has a value, and returns it.

Fields#

Each AltObject holds these values, read when the object was found. They don’t change when the object moves; call UpdateObject to read them again. In C# and Java they are public fields, and in Python read-only properties with the same names, such as alt_object.worldX. In Robot Framework, read them with the Get Object keywords, such as Get Object Name and Get Object WorldX.

Field

Type

Description

name

string

The name of the GameObject or visual element.

id

int

The object’s id in the app. Find the object again with By.ID.

x, y

int

The object’s position on the screen, in pixels from the bottom-left corner.

z

int

The object’s distance from the camera. Negative when the object is behind the camera.

mobileY

int

y counted from the top of the screen, as Appium expects.

type

string

UIToolkit for a UI Toolkit visual element; empty for a GameObject.

enabled

bool

Whether the object itself is active. An object can be inactive in the scene while this is true, because a parent is inactive.

worldX, worldY, worldZ

float

The object’s position in the scene.

idCamera

int

The id of the camera that x, y and z are measured with.

transformId

int

The id of the object’s Transform.

transformParentId

int

The id of the parent’s Transform; 0 for an object at the root of the scene.

In Java, string is String and bool is boolean. When no camera sees the object, x, y and z come from the last camera in the scene; when the scene has no camera, they and idCamera are -1.

Position#

These read the object’s fields and don’t ask the app, so they return where the object was when it was found. Call UpdateObject first if it may have moved.

GetScreenPosition#

Returns the object’s position on the screen, in pixels from the bottom-left corner.

AltVector2 GetScreenPosition()

Example

// altObject is a button: hold the mouse button down on it for 2 seconds.
altDriver.HoldButton(altObject.GetScreenPosition(), 2);
Vector2 getScreenPosition()

Example

// altObject is a button: hold the mouse button down on it for 2 seconds.
altDriver.holdButton(new AltHoldParams.Builder(altObject.getScreenPosition())
        .withDuration(2).build());
alt_object.get_screen_position()

Example

# alt_object is a button: hold the mouse button down on it for 2 seconds.
alt_driver.hold_button(alt_object.get_screen_position(), duration=2)
${position}=    Get Screen Position    alt_object

Example

# alt_object is a button: hold the mouse button down on it for 2 seconds.
${position}=    Get Screen Position    ${alt_object}
Hold Button    ${position}    duration=2

Returns

AltVector2 (C#), Vector2 (Java), tuple (x, y) (Python, Robot): The x and y fields.

See also: GetWorldPosition · UpdateObject

GetWorldPosition#

Returns the object’s position in the scene.

AltVector3 GetWorldPosition()

Example

// altObject is the player: log where it is in the scene.
AltVector3 position = altObject.GetWorldPosition();
Console.WriteLine($"The player is at {position.x}, {position.y}, {position.z}");
Vector3 getWorldPosition()

Example

// altObject is the player: log where it is in the scene.
Vector3 position = altObject.getWorldPosition();
System.out.println(
        "The player is at " + position.x + ", " + position.y + ", " + position.z);
alt_object.get_world_position()

Example

# alt_object is the player: log where it is in the scene.
x, y, z = alt_object.get_world_position()
print(f"The player is at {x}, {y}, {z}")
${position}=    Get World Position    alt_object

Example

# alt_object is the player: log where it is in the scene.
${position}=    Get World Position    ${alt_object}
Log    The player is at ${position}

Returns

AltVector3 (C#), Vector3 (Java), tuple (x, y, z) (Python, Robot): The worldX, worldY and worldZ fields.

See also: GetScreenPosition · UpdateObject

Text#

GetText#

Returns the text of a UI Text, InputField, or TextMeshPro text or input field.

string GetText()

Example

// altObject is the score label.
string score = altObject.GetText();
String getText()

Example

// altObject is the score label.
String score = altObject.getText();
alt_object.get_text()

Example

# alt_object is the score label.
score = alt_object.get_text()
${text}=    Get Text    alt_object

Example

# alt_object is the score label.
${score}=    Get Text    ${alt_object}

Returns

string (C#), String (Java), str (Python, Robot): The text.

Note

The component must be on the object itself. For a button, find the text object inside it, for example with FindObjectFromObject.

In the Non-GPL package it also reads the text of UI Toolkit visual elements.

See also: SetText

SetText#

Sets the text of a UI Text, InputField, or TextMeshPro text or input field.

AltObject SetText(string text, bool submit = false)

Example

// altObject is the name input field: enter a name and submit it.
altObject.SetText("Player One", submit: true);
AltObject setText(String text)
AltObject setText(AltSetTextParams params)

new AltSetTextParams.Builder(String newText)
    .withSubmit(boolean submit)  // default true
    .build()

Example

// altObject is the name input field: enter a name and submit it.
altObject.setText(new AltSetTextParams.Builder("Player One").withSubmit(true).build());
alt_object.set_text(text, submit=False)

Example

# alt_object is the name input field: enter a name and submit it.
alt_object.set_text("Player One", submit=True)
${alt_object}=    Set Text    alt_object    text    submit=False

Example

# alt_object is the name input field: enter a name and submit it.
Set Text    ${alt_object}    Player One    submit=${True}

Parameters

Name

Type

Default

Description

text (C#, Python, Robot)
newText (Java)

string

required

The new text.

submit

bool

false (C#, Python, Robot)
true (Java)

Also send a submit event to the object, as pressing Enter in the field does.

Returns

AltObject: The object, with its current fields.

Note

On an input field it also raises the field’s value changed, submit and end edit events.

In Java, submit defaults to true, both in the builder and in setText(String text).

In the Non-GPL package it also sets the text of UI Toolkit visual elements.

See also: GetText

Component properties and methods#

These read and change the components on the object, such as a Toggle or one of your own scripts, by name. Name the component with its namespace, such as UnityEngine.UI.Toggle, and give the assembly it’s in: Assembly-CSharp for your own scripts, UnityEngine.UI for UI components, UnityEngine.CoreModule for Transform.

GetComponentProperty#

Returns the value of a field or property of a component on the object.

T GetComponentProperty<T>(
    string componentName,
    string propertyName,
    string assemblyName,
    int maxDepth = 2)

Example

// altObject is the Sound toggle: is it on?
bool isOn = altObject.GetComponentProperty<bool>(
    "UnityEngine.UI.Toggle", "isOn", "UnityEngine.UI");
<T> T getComponentProperty(
    AltGetComponentPropertyParams params,
    Class<T> returnType)

new AltGetComponentPropertyParams.Builder(
    String componentName,
    String propertyName,
    String assembly)
    .withMaxDepth(int maxDepth)  // default 2
    .build()

Example

// altObject is the Sound toggle: is it on?
boolean isOn = altObject.getComponentProperty(
        new AltGetComponentPropertyParams.Builder(
                "UnityEngine.UI.Toggle", "isOn", "UnityEngine.UI").build(),
        Boolean.class);
alt_object.get_component_property(
    component_name,
    property_name,
    assembly,
    max_depth=2)

Example

# alt_object is the Sound toggle: is it on?
is_on = alt_object.get_component_property(
    "UnityEngine.UI.Toggle", "isOn", "UnityEngine.UI")
${value}=    Get Component Property    alt_object    component_name    property_name    assembly    max_depth=2

Example

# alt_object is the Sound toggle: is it on?
${is_on}=    Get Component Property    ${alt_object}
...    UnityEngine.UI.Toggle    isOn    UnityEngine.UI

Parameters

Name

Type

Default

Description

componentName (C#, Java)
component_name (Python, Robot)

string

required

The component, with its namespace, such as UnityEngine.UI.Toggle.

propertyName (C#, Java)
property_name (Python, Robot)

string

required

The field or property. Use items[2] for an element of an array, and position.x for a member of a value.

assemblyName (C#)
assembly (Java, Python, Robot)

string

required

The assembly the component is in, such as UnityEngine.UI.

maxDepth (C#, Java)
max_depth (Python, Robot)

int

2

How many levels of a nested value to read.

Returns

T (C#, Java), any (Python, Robot): The value.

Note

In C#, give the type of the value as T, such as GetComponentProperty<bool>. In Java, pass its class as returnType, such as Boolean.class.

See also: WaitForComponentProperty · SetComponentProperty · CallComponentMethod

WaitForComponentProperty#

Waits until a field or property of a component on the object has a value, and returns it.

T WaitForComponentProperty<T>(
    string componentName,
    string propertyName,
    T propertyValue,
    string assemblyName,
    double timeout = 20,
    double interval = 0.5,
    bool getPropertyAsString = false,
    int maxDepth = 2)

Example

// altObject is the Sound toggle: tap it and wait until it's on.
altObject.Tap();
altObject.WaitForComponentProperty(
    "UnityEngine.UI.Toggle", "isOn", true, "UnityEngine.UI", timeout: 5);
<T> T waitForComponentProperty(
    AltWaitForComponentPropertyParams<T> params,
    T propertyValue,
    Class<T> returnType)
<T> T waitForComponentProperty(
    AltWaitForComponentPropertyParams<T> params,
    T propertyValue,
    Boolean getPropertyAsString,
    Class<T> returnType)

Example

// altObject is the Sound toggle: tap it and wait until it's on.
altObject.tap();
AltGetComponentPropertyParams isOn = new AltGetComponentPropertyParams.Builder(
        "UnityEngine.UI.Toggle", "isOn", "UnityEngine.UI").build();
altObject.waitForComponentProperty(
        new AltWaitForComponentPropertyParams.Builder<Boolean>(isOn)
                .withTimeout(5).build(),
        true, Boolean.class);
alt_object.wait_for_component_property(
    component_name,
    property_name,
    property_value,
    assembly,
    timeout=20,
    interval=0.5,
    get_property_as_string=False,
    max_depth=2)

Example

# alt_object is the Sound toggle: tap it and wait until it's on.
alt_object.tap()
alt_object.wait_for_component_property(
    "UnityEngine.UI.Toggle", "isOn", True, "UnityEngine.UI", timeout=5)
${value}=    Wait For Component Property    alt_object    component_name    property_name    property_value    assembly    timeout=20    interval=0.5    get_property_as_string=False    max_depth=2

Example

# alt_object is the Sound toggle: tap it and wait until it's on.
Tap Object    ${alt_object}
Wait For Component Property    ${alt_object}
...    UnityEngine.UI.Toggle    isOn    ${True}    UnityEngine.UI    timeout=5

Parameters

Name

Type

Default

Description

componentName (C#, Java)
component_name (Python, Robot)

string

required

The component, with its namespace, such as UnityEngine.UI.Toggle.

propertyName (C#, Java)
property_name (Python, Robot)

string

required

The field or property. Use items[2] for an element of an array, and position.x for a member of a value.

propertyValue (C#, Java)
property_value (Python, Robot)

C#, Java: T
Python, Robot: any

required

The value to wait for.

assemblyName (C#)
assembly (Java, Python, Robot)

string

required

The assembly the component is in, such as UnityEngine.UI.

timeout

C#, Java: double
Python, Robot: float

20

Seconds to wait before failing with a timeout error. Left at 20, the implicit timeout is used if you set one with SetImplicitTimeout.

interval

C#, Java: double
Python, Robot: float

0.5

Seconds between two reads of the value.

getPropertyAsString (C#, Java)
get_property_as_string (Python, Robot)

bool

false

Compare the value and propertyValue as JSON text. Use it for values that don’t compare well as T, such as nested arrays: in C#, pass JToken.Parse("[[], []]") as propertyValue.

maxDepth (C#, Java)
max_depth (Python, Robot)

int

2

How many levels of a nested value to read.

Returns

T (C#, Java), any (Python, Robot): The value, once it matches propertyValue.

Note

In Java, put componentName, propertyName, assemblyName and maxDepth in an AltGetComponentPropertyParams, and pass it to new AltWaitForComponentPropertyParams.Builder<T>(...), which sets timeout and interval with .withTimeout() and .withInterval(). getPropertyAsString defaults to false when you leave it out.

See also: GetComponentProperty

SetComponentProperty#

Sets a field or property of a component on the object.

void SetComponentProperty(
    string componentName,
    string propertyName,
    object value,
    string assemblyName)

Example

// altObject is the Sound toggle: turn it off.
altObject.SetComponentProperty("UnityEngine.UI.Toggle", "isOn", false, "UnityEngine.UI");
void setComponentProperty(AltSetComponentPropertyParams params)

new AltSetComponentPropertyParams.Builder(
    String componentName,
    String propertyName,
    String assembly,
    Object value)
    .build()

Example

// altObject is the Sound toggle: turn it off.
altObject.setComponentProperty(new AltSetComponentPropertyParams.Builder(
        "UnityEngine.UI.Toggle", "isOn", "UnityEngine.UI", false).build());
alt_object.set_component_property(
    component_name,
    property_name,
    assembly,
    value)

Example

# alt_object is the Sound toggle: turn it off.
alt_object.set_component_property(
    "UnityEngine.UI.Toggle", "isOn", "UnityEngine.UI", False)
Set Component Property    alt_object    component_name    property_name    assembly    value

Example

# alt_object is the Sound toggle: turn it off.
Set Component Property    ${alt_object}
...    UnityEngine.UI.Toggle    isOn    UnityEngine.UI    ${False}

Parameters

Name

Type

Default

Description

componentName (C#, Java)
component_name (Python, Robot)

string

required

The component, with its namespace, such as UnityEngine.UI.Toggle.

propertyName (C#, Java)
property_name (Python, Robot)

string

required

The field or property to set.

assemblyName (C#)
assembly (Java, Python, Robot)

string

required

The assembly the component is in, such as UnityEngine.UI.

value

C#, Java: object
Python, Robot: any

required

The new value.

Returns

Nothing.

Note

In C#, value comes before assemblyName; in the other languages, after it.

See also: GetComponentProperty · CallComponentMethod

CallComponentMethod#

Calls a public method of a component on the object, and returns what it returns.

T CallComponentMethod<T>(
    string componentName,
    string methodName,
    string assemblyName,
    object[] parameters,
    string[] typeOfParameters = null)

Example

// altObject is the player: call CountItems("Potion") on your Inventory script.
int potions = altObject.CallComponentMethod<int>(
    "Inventory", "CountItems", "Assembly-CSharp", new object[] { "Potion" });
<T> T callComponentMethod(
    AltCallComponentMethodParams params,
    Class<T> returnType)

new AltCallComponentMethodParams.Builder(
    String componentName,
    String methodName,
    String assembly,
    Object[] parameters)
    .withTypeOfParameters(String[] typeOfParameters)  // default null
    .build()

Example

// altObject is the player: call CountItems("Potion") on your Inventory script.
int potions = altObject.callComponentMethod(
        new AltCallComponentMethodParams.Builder(
                "Inventory", "CountItems", "Assembly-CSharp", new Object[] {"Potion"})
                .build(),
        Integer.class);
alt_object.call_component_method(
    component_name,
    method_name,
    assembly,
    parameters=None,
    type_of_parameters=None)

Example

# alt_object is the player: call CountItems("Potion") on your Inventory script.
potions = alt_object.call_component_method(
    "Inventory", "CountItems", "Assembly-CSharp", parameters=["Potion"])
${result}=    Call Component Method    alt_object    component_name    method_name    assembly    parameters=None    type_of_parameters=None

Example

# alt_object is the player: call CountItems("Potion") on your Inventory script.
${arguments}=    Create List    Potion
${potions}=    Call Component Method    ${alt_object}
...    Inventory    CountItems    Assembly-CSharp    parameters=${arguments}

Parameters

Name

Type

Default

Description

componentName (C#, Java)
component_name (Python, Robot)

string

required

The component, with its namespace, such as UnityEngine.UI.Toggle.

methodName (C#, Java)
method_name (Python, Robot)

string

required

The method. For a method of a field or property of the component, use fieldName.MethodName. A property’s getter and setter are get_name and set_name, such as get_fontSize.

assemblyName (C#)
assembly (Java, Python, Robot)

string

required

The assembly the component is in, such as UnityEngine.UI.

parameters

C#: object[]
Java: Object[]
Python, Robot: list

required (C#, Java)
null (Python, Robot)

The method’s arguments, in order. In C# and Java, pass an empty array for a method without arguments.

typeOfParameters (C#, Java)
type_of_parameters (Python, Robot)

C#: string[]
Java: String[]
Python, Robot: list of str

null

The type of each argument, such as System.Int32, to choose between methods with the same name.

Returns

T (C#, Java), any (Python, Robot): What the method returns; null (None) for a void method.

Note

In C#, give the type of the result as T, such as CallComponentMethod<int>. In Java, pass its class as returnType, such as Integer.class, or Void.class for a void method.

See also: GetComponentProperty · SetComponentProperty

Input on the object#

Tap and Click simulate a player’s touch or mouse input on the object. The pointer commands send one UI event straight to the object, to test how it handles that event.

Tap#

Taps the object, once or several times.

AltObject Tap(int count = 1, float interval = 0.1f, bool wait = true)

Example

// altObject is a tile: double-tap it.
altObject.Tap(count: 2);
AltObject tap()
AltObject tap(AltTapClickElementParams params)

new AltTapClickElementParams.Builder()
    .withCount(int count)  // default 1
    .withInterval(float interval)  // default 0.1f
    .withWait(boolean wait)  // default true
    .build()

Example

// altObject is a tile: double-tap it.
altObject.tap(new AltTapClickElementParams.Builder().withCount(2).build());
alt_object.tap(count=1, interval=0.1, wait=True)

Example

# alt_object is a tile: double-tap it.
alt_object.tap(count=2)
${alt_object}=    Tap Object    alt_object    count=1    interval=0.1    wait=True

Example

# alt_object is a tile: double-tap it.
Tap Object    ${alt_object}    count=2

Parameters

Name

Type

Default

Description

count

int

1

How many times to tap.

interval

float

0.1

Seconds between taps.

wait

bool

true

Wait for the command to finish before returning.

Returns

AltObject (C#, Java, Python), None (Robot): The object, with its current fields. The Robot Framework keyword returns nothing.

See also: Click · PointerDown

Click#

Clicks the object with the mouse, once or several times.

AltObject Click(
    int count = 1,
    float interval = 0.1f,
    bool wait = true)

Example

// altObject is the Play button: click it.
altObject.Click();
AltObject click()
AltObject click(AltTapClickElementParams params)

new AltTapClickElementParams.Builder()
    .withCount(int count)  // default 1
    .withInterval(float interval)  // default 0.1f
    .withWait(boolean wait)  // default true
    .build()

Example

// altObject is the Play button: click it.
altObject.click();
alt_object.click(count=1, interval=0.1, wait=True)

Example

# alt_object is the Play button: click it.
alt_object.click()
${alt_object}=    Click Object    alt_object    count=1    interval=0.1    wait=True

Example

# alt_object is the Play button: click it.
Click Object    ${alt_object}

Parameters

Name

Type

Default

Description

count

int

1

How many times to click. 2 is a double-click.

interval

float

0.1

Seconds between clicks.

wait

bool

true

Wait for the command to finish before returning.

Returns

AltObject (C#, Java, Python), None (Robot): The object, with its current fields. The Robot Framework keyword returns nothing.

See also: Tap · PointerDown

PointerDown#

Sends the object a pointer down event, as when a mouse button or finger is pressed on it.

AltObject PointerDown()

Example

// altObject is a "hold to charge" button: press it for 2 seconds.
altObject.PointerDown();
Thread.Sleep(2000);
altObject.PointerUp();
AltObject pointerDown()

Example

// altObject is a "hold to charge" button: press it for 2 seconds.
altObject.pointerDown();
Thread.sleep(2000);
altObject.pointerUp();
alt_object.pointer_down()

Example

# alt_object is a "hold to charge" button: press it for 2 seconds.
alt_object.pointer_down()
time.sleep(2)
alt_object.pointer_up()
${alt_object}=    Pointer Down    alt_object

Example

# alt_object is a "hold to charge" button: press it for 2 seconds.
Pointer Down    ${alt_object}
Sleep    2s
Pointer Up    ${alt_object}

Returns

AltObject: The object, with its current fields.

Note

Only the object’s own handler of the event runs: nothing moves on the screen, and the object’s parents don’t get the event.

See also: PointerUp · Tap

PointerUp#

Sends the object a pointer up event, as when a mouse button or finger is released over it.

AltObject PointerUp()

Example

// altObject is a "hold to charge" button: press it for 2 seconds.
altObject.PointerDown();
Thread.Sleep(2000);
altObject.PointerUp();
AltObject pointerUp()

Example

// altObject is a "hold to charge" button: press it for 2 seconds.
altObject.pointerDown();
Thread.sleep(2000);
altObject.pointerUp();
alt_object.pointer_up()

Example

# alt_object is a "hold to charge" button: press it for 2 seconds.
alt_object.pointer_down()
time.sleep(2)
alt_object.pointer_up()
${alt_object}=    Pointer Up    alt_object

Example

# alt_object is a "hold to charge" button: press it for 2 seconds.
Pointer Down    ${alt_object}
Sleep    2s
Pointer Up    ${alt_object}

Returns

AltObject: The object, with its current fields.

Note

Only the object’s own handler of the event runs: nothing moves on the screen, and the object’s parents don’t get the event.

See also: PointerDown

PointerEnter#

Sends the object a pointer enter event, as when the mouse moves over it.

AltObject PointerEnter()

Example

// altObject is an inventory slot: hover over it to show its tooltip, then leave.
altObject.PointerEnter();
var tooltip = altDriver.WaitForObject(By.NAME, "Tooltip");
altObject.PointerExit();
AltObject pointerEnter()

Example

// altObject is an inventory slot: hover over it to show its tooltip, then leave.
altObject.pointerEnter();
AltObject tooltip = altDriver.waitForObject(new AltWaitForObjectsParams.Builder(
        new AltFindObjectsParams.Builder(AltDriver.By.NAME, "Tooltip").build()).build());
altObject.pointerExit();
alt_object.pointer_enter()

Example

# alt_object is an inventory slot: hover over it to show its tooltip, then leave.
alt_object.pointer_enter()
tooltip = alt_driver.wait_for_object(By.NAME, "Tooltip")
alt_object.pointer_exit()
${alt_object}=    Pointer Enter    alt_object

Example

# alt_object is an inventory slot: hover over it to show its tooltip, then leave.
Pointer Enter    ${alt_object}
${tooltip}=    Wait For Object    NAME    Tooltip
Pointer Exit    ${alt_object}

Returns

AltObject: The object, with its current fields.

Note

Only the object’s own handler of the event runs: nothing moves on the screen, and the object’s parents don’t get the event.

See also: PointerExit

PointerExit#

Sends the object a pointer exit event, as when the mouse moves off it.

AltObject PointerExit()

Example

// altObject is an inventory slot: hover over it to show its tooltip, then leave.
altObject.PointerEnter();
var tooltip = altDriver.WaitForObject(By.NAME, "Tooltip");
altObject.PointerExit();
AltObject pointerExit()

Example

// altObject is an inventory slot: hover over it to show its tooltip, then leave.
altObject.pointerEnter();
AltObject tooltip = altDriver.waitForObject(new AltWaitForObjectsParams.Builder(
        new AltFindObjectsParams.Builder(AltDriver.By.NAME, "Tooltip").build()).build());
altObject.pointerExit();
alt_object.pointer_exit()

Example

# alt_object is an inventory slot: hover over it to show its tooltip, then leave.
alt_object.pointer_enter()
tooltip = alt_driver.wait_for_object(By.NAME, "Tooltip")
alt_object.pointer_exit()
${alt_object}=    Pointer Exit    alt_object

Example

# alt_object is an inventory slot: hover over it to show its tooltip, then leave.
Pointer Enter    ${alt_object}
${tooltip}=    Wait For Object    NAME    Tooltip
Pointer Exit    ${alt_object}

Returns

AltObject: The object, with its current fields.

Note

Only the object’s own handler of the event runs: nothing moves on the screen, and the object’s parents don’t get the event.

See also: PointerEnter

UI Toolkit visual elements#

The Non-GPL package finds UI Toolkit visual elements as well as GameObjects. These commands read their properties. On an object that isn’t a visual element, they fail with WrongAltObjectTypeException. See also Testing UI Toolkit.

GetVisualElementProperty#

Non-GPL Returns the value of a property of a visual element.

T GetVisualElementProperty<T>(string propertyName)

Example

// altObject is a UI Toolkit button: read its width.
float width = altObject.GetVisualElementProperty<float>("width");
<T> T getVisualElementProperty(
    String propertyName,
    Class<T> returnType)

Example

// altObject is a UI Toolkit button: read its width.
float width = altObject.getVisualElementProperty("width", Float.class);
alt_object.get_visual_element_property(property_name)

Example

# alt_object is a UI Toolkit button: read its width.
width = alt_object.get_visual_element_property("width")
${value}=    Get Visual Element Property    alt_object    property_name

Example

# alt_object is a UI Toolkit button: read its width.
${width}=    Get Visual Element Property    ${alt_object}    width

Parameters

Name

Type

Default

Description

propertyName (C#, Java)
property_name (Python, Robot)

string

required

A public property of the element, such as value of a Toggle or Slider, or of its resolved style, such as width (see IResolvedStyle). text returns the element’s text.

Returns

T (C#, Java), any (Python, Robot): The value, or null (None) when the element has no such property.

Note

In C#, give the type of the value as T, such as GetVisualElementProperty<float>. In Java, pass its class as returnType, such as Float.class. Java’s GetVisualElementProperty, with a capital letter, is deprecated.

See also: WaitForVisualElementProperty

WaitForVisualElementProperty#

Non-GPL Waits until a property of a visual element has a value, and returns it.

T WaitForVisualElementProperty<T>(
    string propertyName,
    T propertyValue,
    double timeout = 20,
    double interval = 0.5,
    bool getPropertyAsString = false)

Example

// altObject is a UI Toolkit panel that fades in: wait until it's opaque.
altObject.WaitForVisualElementProperty("opacity", 1f, timeout: 5);
<T> T waitForVisualElementProperty(
    AltWaitForVisualElementPropertyParams params,
    T propertyValue,
    boolean getPropertyAsString,
    Class<T> returnType)

Example

// altObject is a UI Toolkit panel that fades in: wait until it's opaque.
altObject.waitForVisualElementProperty(
        new AltWaitForVisualElementPropertyParams.Builder("opacity")
                .withTimeout(5).build(),
        1f, false, Float.class);
alt_object.wait_for_visual_element_property(
    property_name,
    property_value,
    timeout=20,
    interval=0.5,
    get_property_as_string=False)

Example

# alt_object is a UI Toolkit panel that fades in: wait until it's opaque.
alt_object.wait_for_visual_element_property("opacity", 1, timeout=5)
${value}=    Wait For Visual Element Property    alt_object    property_name    property_value    timeout=20    interval=0.5    get_property_as_string=False

Example

# alt_object is a UI Toolkit panel that fades in: wait until it's opaque.
Wait For Visual Element Property    ${alt_object}    opacity    ${1}    timeout=5

Parameters

Name

Type

Default

Description

propertyName (C#, Java)
property_name (Python, Robot)

string

required

A public property of the element, such as value of a Toggle or Slider, or of its resolved style, such as width (see IResolvedStyle). text returns the element’s text.

propertyValue (C#, Java)
property_value (Python, Robot)

C#, Java: T
Python, Robot: any

required

The value to wait for.

timeout

C#, Java: double
Python, Robot: float

20

Seconds to wait before failing with a timeout error. Left at 20, the implicit timeout is used if you set one with SetImplicitTimeout.

interval

C#, Java: double
Python, Robot: float

0.5

Seconds between two reads of the value.

getPropertyAsString (C#, Java)
get_property_as_string (Python, Robot)

bool

false (C#, Python, Robot)
required (Java)

Compare the value and propertyValue as text.

Returns

T (C#, Java), any (Python, Robot): The value, once it matches propertyValue.

Note

In Java, pass propertyName in new AltWaitForVisualElementPropertyParams.Builder(propertyName), which sets timeout and interval with .withTimeout() and .withInterval().

See also: GetVisualElementProperty