Ask a Question

Not able to synchronize object on screen with testcomplete

meenakshiyadav1
Contributor

Not able to synchronize object on screen with testcomplete

I am working on a flex based web application which takes time to load so I am using static delay which increases execution time significantly. I want to write a function to sync TestComplete with the object expected to be on screen.
I have written below code where I am passing the object that needs to be sync as a parameter but it is not working. I am new to Javascript so might be making some mistakes. can anyone please help.

 

 

function sync(syncobj)
{
var i=0
while (syncobj==NULL)

{
If (i > 60)
{
Log.Message("Object = " +syncobj + " not found")
}
aqutils.Delay(1000)
Log.Message("Syncing object")
i = i++
}
return syncobj
}

 

I am calling this sync function before the statement in which the object is getting used. While debugging I am getting error "Object expected" at If condition statement.

8 REPLIES 8
baxatob
Community Hero

Hi,

 

First of all, what kind of object you are passing to the function? Please show, how you do it.

 

Anyway, if the object was not found at the moment of calling function, it would be a STUB object (not NULL). And this object will not changed within your function. 

 

 

object may be of any type , combox, button, window etc

 

var OpenDefaultBox= vizbybis.mainview.exploresearch.containingbox.opendefaultcombobox
sync(OpenDefaultBox);
OpenDefaultBox.Click();

 

 

As I said, if the object above is not presented in the system at the moment, when OpenDefaultBox variable was assigned, your function will not work.

 

Please read the topics about common tasks in object searching and waiting: https://support.smartbear.com/testcomplete/docs/app-objects/common-tasks/index.html

 

Probably you can use WaitAliasChild() method in your case.

 

 

WaitAliasChild is also not working .

JScript runtime error. Object doesn't support this property or method  

JScript runtime error.


This is how I am using it:
 
var OpenDefaultBox= vizbybis.mainview.exploresearch.containingbox.opendefaultcombobox
if(vizbybis.WaitAliasChild(OpenDefaultBox, 10000).Exists)
{
OpenDefaultBox.Click();
}
else
Log.Message(OpenDefaultBox+" object not found")

No, you are using wrong objects.

 

Your target object is vizbybis.mainview.exploresearch.containingbox.opendefaultcombobox

 

So you should code it like:

 

parent_object = vizbybis.mainview.exploresearch.containingbox 
child_object = parent_object.WaitAliasChild("opendefaultcombobox", 10000)

 

Still not working.

 

var Parentobj= vizbybis.mainview.exploresearch.containingbox
if(Parentobj.WaitAliasChild("OpenDefaultBox", 10000).Exists)
{
OpenDefaultBox.Click();
}
else
Log.Message(OpenDefaultBox+" object not found")

 

getting below error:

JScript runtime error. The Aliases.browser.page.objvizexplorer.vizexplorer.mainview.exploresearch.containingbox object does not have a child with the name "OpenDefaultBox".

 

Even though the object is mapped in name mapping.attaching the screenshot2018-06-19_16-27-13.png

 

Sure, because your alias name is "opendefaultcombobox"

yes, I just noticed it. I will correct it and try again. Many thanks for the quick response.

cancel
Showing results for 
Search instead for 
Did you mean: