Forum Discussion
I have found best results using WaitChild or WaitAliasChild(if you use NameMapping Aliases).
Directly checking Exists on an object throws an error while Delay() will always add fixed additonal time to the script while running.
WaitChild over comes both of these issues.
Here is more information on WaitChild: https://support.smartbear.com/viewarticle/72783/
Also be aware that even though some objects exists may not visible
in which case TC coulc not use or operate the object
It is usefull in some case check visible or VisibleOnScreen is true
along with Exists see this
- abrar229 years agoFrequent Contributor
Hi,
Thanks for you replies.
So I have WBtn_ABC in ny Name mapping (Aliases.Product.TransitionBox.PriceTicker.WBtn_ABC)Can i just use
(WBtn_ABC.Exists &&WBtn_ABC.VisibleOnScreen)
?
Thanks
A
- djadhav9 years agoRegular Contributor
If you do this
(WBtn_ABC.Exists &&WBtn_ABC.VisibleOnScreen)
WBtn_ABC.Exists can throw an error and stop the script if the object does not exist.
I would do it this way:
IF Aliases.Product.TransitionBox.PriceTicker.WaitAliasChild("WBtn_ABC", 10000).Exists THEN IF Aliases.Product.TransitionBox.PriceTicker.WBtn_ABC.VisibleOnScreen THEN 'Do something because it is visible on screen END IF ELSE Log.Error("The WBtn_ABC object does not exist") END IF
NOTE: The number 10000 means I would like to wait 10 seconds to check if the object exists. You can change it as required.
- m_essaid9 years agoValued Contributor
I have now plenty of functions that waits for an enabled state, or disabled, or exists, or not, etc etc
I use a delay (ms) and a an passes (integer)
at every passes, I wait for the delay time. and they I check the property. when the test returns true, stop, exit.
function WaitForExists(Alias: AliasObj; Time, Passes: integer): boolean;
var
i: integer;
begin
result:= false;
for i:= 0 to Passes do
begin
Delay(Time);// note : put wathever you want in this test :
if (Alias.Exists) then
begin
result:= true;
exit;
end;
end;
end;
Related Content
- 2 years ago
- 6 months ago
Recent Discussions
- 4 days ago
- 4 days ago
- 7 days ago