Object recognition problem
QTP able to identify the 'Ok' Webbutton object most of the time. But sometimes it throws the error 'Object cannot be identified...'.
When I click the 'Retry' button in the RunError dialog , it is able to identify the objects.
I tried using the sync before clicking the buttton like Browser().Page().Sync., still see the issue
I do not know what is the cause of this problem
Can anybody help with this?
Try throwing a browser.page.webbutton.exist(30) on there before you try to click.
'Something like this?
for i = 1 to 30
if browser.page.webbutton.exist(0) then
This is resolved
I used Wait(1) and it worked.
Yogi, I will use the above code, since this happens only sometimes. Wait if the button does not exist.
Why use that for loop?
The exist(30) has that functionality built-in with the specified timeout.
Exist(30) will exit as soon as the object is available, the for loop in that context is pointless and includes a hard wait of 1 second which could be excessive.
Your post is incorrect, OST is only used if Exist() is blank.
Optional. An ULong object.
The length of time (in seconds) to search for the object before returning a True or False value.
If a timeout value is specified, QuickTest waits until it finds the object or until the timeout is reached.
If the value 0 is specified, the property returns the True or False value immediately.
If no value is specified, the value specified in the Test Settings dialog box for the Object Synchronization Timeout is used for tests. For business components, the pre-defined value of 20 seconds is used.
For more information on the Object Synchronization Timeout, see the QuickTest Professional User's Guide.
OST would only enter the picture on a specified exist timeout if one of the parent objects was not available. i.e. Browser(a).page(b).object(c).exist(5) with a OST setting of 20, could still wait for the 20 if Browser(a) or page(b) did not exist. As I imagine in your test scenario on your blog post you simply did not load the browser rather than check for an object not present on an existing page.
Best thing to do would be this with the first two if conditions just global for all operations on the page.
All code for this page goes here
msgbox object does not exist
msgbox page(b) does not exist
msgbox browser doesn't exist
Last edited by NoUse4aName; 07-19-2013 at 09:22 AM.
You may also want to make use of the .highlight function. I like to use it so that I know that QTP did find the object before clicking on it. I leave them in for a while in trouble spots to remember it was a place where the script was having trouble with a particular object. I remove them after I see the script no longer having an issue.
The scenario was this,
Click on a status radio button
A Editbox (to enter notes) appear on the screen below the radio button
The 'Ok' button moves down the notes which was prev below the radio button.
So the page sync which i used was because i thought the page was loaded again to get the edit box
This dint help me.
I used webbutton.exist(30) and it worked.
Looks like, after the radio button is clicked, when QTP tries to identify the object (where the object not in place for less than sec )and while the edit box is loading it could not recognize the object at that timing ...
Thanks for all the help!
@NoUse4aName, In the post the parent hierarchy is also missing during execution , it not just checking particular object but verifying whole hierarchy and thats why that post provide relationship of .exist and OST timeout. It has not be tested on the object alone, though as per help file what you have mention should correlate ( might be new post )
@QATester10 , You can also explore waitproperty , getRoprperty , .exist, wait , sync, refresh, OST and .exist ,.highlight these all "can" be related to synchronization.
YOGI - Technology Tree QTP: QTP - Wait with Variable time