Obviously, I’m brand new to QTP. I use it to test an HTML page with several forms; one right after the other.
It used to work fine. Now I’m constantly seeing this:
Smart identification mechanism was invoked – Object not found.
Why does this happen? All I’m trying to do is set focus to a text input and enter some data and click submit.
Any helpful tips would be great. QTP has such a steep learning curve.
Thank you!
Let me bit a bit more specific: There are 40 forms on this HTML page and several of them use an input element with an identical name property. Is this the issue?
<input type="text" name="meetingId" />
<input type="text" name="meetingid" />
Notice the case sensitivity of meetingId/meetingid in these two examples. Is this an issue?
When QTP records (or learns) an object it captures a set of property/values which is enough to uniquely identify this object. Additionally, if smart identification is enabled, it will capture a few extra property/value pairs for future use.
When executing a test if the object to be identified isn’t found (either no element matches the description or there are multiple elements that do) it will try to use the extra properties in order to find the element.
If at first your test ran without smart identification being triggered and now it is being triggered it means that the HTML has changed so that the description no longer uniquely identifies the element and QTP makes an educated guess as to which element the test describes (apparently in your case it’s a good guess since the test still works).
QTP considers this to be sub-optimal since it’s really a guess and that is why the smart identification shows up in the report. Your are in effect prompted to refine your test by improving the test object’s description.
A few more details: If the set of properties defined in the object identification dialog (
Tools -> Object Identification) aren’t enough to identify the element uniquely QTP adds an Ordinal Identifier usually of typeIndexwhich means “Of theNelements that match the description use#X“. An ordinal identifier is considered to be a last resort and QTP will try to use smart identification before resorting to using the ordinal identier. So if your object uses an ordinal identifier it will use smart identification even if the HTML page hasn’t changed at all.The exception to this rule is that there is another optimization of using the
source index(and starting in QTP 11 a generated XPath expression) that may help identifying the object. If these are active (Tools -> Options -> Web -> Advanced -> Run settings) and the element suggested matches the existing description (not including ordinal identifier) then smart identification isn’t used.If you inspect
Browser‘s Object Identification you will see that there are no properties listed in the description therefore if more than one Browser exists we will always get an ordinal and smart identification will attempt to run.