waitForObjectItem
Object waitForObjectItem(objectOrName, itemOrIndex)
Object waitForObjectItem(objectOrName, itemOrIndex, timeoutMSec)
Waits until the objectOrName
object is accessible (i.e., it exists and is visible and enabled), and contains an item that is identified by the itemOrIndex
and that is itself accessible.
The given name can also be a native script dictionary (resp. hash) value.
This function is typically used to access items inside containers such as lists, tables, and trees.
The itemOrIndex
for a table can be a row/column
string like "4/21"
. In a tree, it can be a period (.)
-separated path string such as Mammals.Felines.Cats
. In a list where strings may appear multiple times, a specific item can be selected by appending (_)
followed by the item's occurrence index, to the non-unique string. For example, "itemtext_3"
would retrieve the third item in the list which contains the "itemtext
" string.
Note: When passing string literals to the waitForObjectItem()
function which actually contain characters mentioned in the previous paragraph ((/)
, (.)
and (_)
), these characters need to be escaped by (\\)
(two backslashes) to make waitForObjectItem()
function work properly. Without escaping, the waitForObjectItem()
function would truncate a given string passed as itemOrIndex
, treating anything which follows after a recognized delimiter as being either 'row/col', 'index' or 'path' parameter!
The return value depends on the Squish edition:
- Java, Qt and Windows: The return value is a reference to the item. (The reference can be used with other Squish functions.)
- Web and other Squish editions: The return value is a reference to the object identified by
objectOrName
(not the item).
The function raises a (catchable) LookupError
exception on failure, i.e., if it times out.
The function waits for the time defined by the testSettings.waitForObjectTimeout property or if the optional timeoutMSec
parameter is used, that many milliseconds.
Additional processing can be done on the object items before this function returns, by providing a user-defined callback function. See waitUntilObjectItemReady(item) for details.
© 2024 The Qt Company Ltd.
Documentation contributions included herein are the copyrights of
their respective owners.
The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.
Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property
of their respective owners.