Not able to synchronize object on screen with testcomplete
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
object may be of any type , combox, button, window etc
var OpenDefaultBox= vizbybis.mainview.exploresearch.containingbox.opendefaultcombobox
sync(OpenDefaultBox);
OpenDefaultBox.Click();
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
WaitAliasChild is also not working .
JScript runtime error. Object doesn't support this property or method
if(vizbybis.WaitAliasChild(OpenDefaultBox, 10000).Exists)
{
OpenDefaultBox.Click();
}
else
Log.Message(OpenDefaultBox+" object not found")
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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)
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 screenshot
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sure, because your alias name is "opendefaultcombobox"
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yes, I just noticed it. I will correct it and try again. Many thanks for the quick response.
