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 |
|---|---|
Finds the first object below this one, at any depth, that matches the criteria. |
|
Returns the object’s parent. |
|
Reads the object’s fields again from the app, such as its position after it moved. |
|
Returns the object’s position on the screen, in pixels from the bottom-left corner. |
|
Returns the object’s position in the scene. |
|
Returns the text of a UI Text, InputField, or TextMeshPro text or input field. |
|
Sets the text of a UI Text, InputField, or TextMeshPro text or input field. |
|
Returns the value of a field or property of a component on the object. |
|
Waits until a field or property of a component on the object has a value, and returns it. |
|
Sets a field or property of a component on the object. |
|
Calls a public method of a component on the object, and returns what it returns. |
|
Taps the object, once or several times. |
|
Clicks the object with the mouse, once or several times. |
|
Sends the object a pointer down event, as when a mouse button or finger is pressed on it. |
|
Sends the object a pointer up event, as when a mouse button or finger is released over it. |
|
Sends the object a pointer enter event, as when the mouse moves over it. |
|
Sends the object a pointer exit event, as when the mouse moves off it. |
|
Non-GPL Returns the value of a property of a visual element. |
|
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 |
|---|---|---|
|
string |
The name of the GameObject or visual element. |
|
int |
The object’s id in the app. Find the object again with |
|
int |
The object’s position on the screen, in pixels from the bottom-left corner. |
|
int |
The object’s distance from the camera. Negative when the object is behind the camera. |
|
int |
|
|
string |
|
|
bool |
Whether the object itself is active. An object can be inactive in the scene while this is |
|
float |
The object’s position in the scene. |
|
int |
The id of the camera that |
|
int |
The id of the object’s Transform. |
|
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 |
|---|---|---|---|
|
|
required |
The new text. |
|
|
|
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 |
|---|---|---|---|
|
|
required |
The component, with its namespace, such as |
|
|
required |
The field or property. Use |
|
|
required |
The assembly the component is in, such as |
|
|
|
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 |
|---|---|---|---|
|
|
required |
The component, with its namespace, such as |
|
|
required |
The field or property. Use |
|
C#, Java: |
required |
The value to wait for. |
|
|
required |
The assembly the component is in, such as |
|
C#, Java: |
|
Seconds to wait before failing with a timeout error. Left at 20, the implicit timeout is used if you set one with SetImplicitTimeout. |
|
C#, Java: |
|
Seconds between two reads of the value. |
|
|
|
Compare the value and |
|
|
|
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 |
|---|---|---|---|
|
|
required |
The component, with its namespace, such as |
|
|
required |
The field or property to set. |
|
|
required |
The assembly the component is in, such as |
|
C#, Java: |
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 |
|---|---|---|---|
|
|
required |
The component, with its namespace, such as |
|
|
required |
The method. For a method of a field or property of the component, use |
|
|
required |
The assembly the component is in, such as |
|
C#: |
required (C#, Java) |
The method’s arguments, in order. In C# and Java, pass an empty array for a method without arguments. |
|
C#: |
|
The type of each argument, such as |
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 |
|---|---|---|---|
|
|
|
How many times to tap. |
|
|
|
Seconds between taps. |
|
|
|
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 |
|---|---|---|---|
|
|
|
How many times to click. 2 is a double-click. |
|
|
|
Seconds between clicks. |
|
|
|
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.
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 |
|---|---|---|---|
|
|
required |
A public property of the element, such as |
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 |
|---|---|---|---|
|
|
required |
A public property of the element, such as |
|
C#, Java: |
required |
The value to wait for. |
|
C#, Java: |
|
Seconds to wait before failing with a timeout error. Left at 20, the implicit timeout is used if you set one with SetImplicitTimeout. |
|
C#, Java: |
|
Seconds between two reads of the value. |
|
|
|
Compare the value and |
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