Forum Discussion
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
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; - abrar229 years agoFrequent Contributor
So, does it mean that it will always wait for 10 secs even the element is visible before that? Then whats the difference between using this method and delay ?
- djadhav9 years agoRegular Contributor
The WaitAliasChild or the WaitChild methods wait only till the element is visible. The time we specify is the maximum amount of time we want it to wait.
Which means if the element becomes visible in 1 second, it method will return the child object instantly, but if it becomes visible after 12 seconds, it'll fail because we gave 10 seconds as maximum wait time and the method would already have returned an object which will return false for the exists method.
Here is some more information: https://support.smartbear.com/viewarticle/70275/
Related Content
- 2 years ago
- 5 months ago
Recent Discussions
- 24 hours ago