We often face a problem like we want to add dynamic wait for an element to appear on screen before click. Test Complete providing page wait methods. But they are of no use if you are using any dynamic bindings to elements on a page. So in such scenarios, you have to handle this on your own. The below script might help you.
function
waitObjectByProperty(property, text, maxTime)
{
var
object;
var
counter=0;
if
(maxTime== undefined)
maxTime= 20000;
if
(property== undefined)
property=
"objectIdentifier"
;
do
{
aqUtils.Delay(100);
counter+= 100;
Indicator.PushText(counter);
if
(counter>maxTime)
{
Log.Warning(
"Time Exceeded"
);
return
;
}
object= Sys.Browser(Project.Variables.browser).Page(
"*"
).Find(property,text, 30,
true
);
Indicator.PopText();
}
while
(! object.Exists)
object.Click();
}
No comments:
Post a Comment