Forum Discussion

paul_disselhors's avatar
paul_disselhors
New Contributor
13 years ago

Ambiguous recognition of the tested object

Hello,




I am encountering a strange error in the development of a TestComplete script.




The script involves logging into a web page, and this is the third script/project I've worked on. The previous two had no issues.




The script is in VB and looks like this:




1. Call TestedApps.IEXPLORE.Run(1, True)

2. Set iexplore = Aliases.IEXPLORE

3. Call iexplore.ToUrl(url)

4. waitForComponent
(iexplore..panelIdMainscreen.panelContainer.panelMaincontent.table.formForm2.cell)

5. Set cell = iexplore..panelIdMainscreen.panelContainer.panelMaincontent.table.formForm2.cell

6. waitForComponent(cell.textnode.textboxUsername)

7. Set textbox = cell.textnode.textboxUsername

8. textbox.SetText(uname)

9. waitForComponent(cell.textnode2.passwordboxPassword)

10. Set passwordBox = cell.textnode2.passwordboxPassword

11. Call passwordBox.SetText(password)



I am getting the "Ambiguous recognition of the tested object" error on lines 8 and 11.



If I go into Object Browser, go to the iexplore process and drill down the hierarchy to formForm2, there are two Cell(1,0) listings. This cell houses the user and password textboxes. Under the first Cell(1,0) listed is where the username is located, under TextNode(0) -> Textbox("username"). This is the box having issues. Under the second Cell(1,0), all the textboxes are located under a Panel, and these textboxes have no issues being found during test run.



Now, while in Object Browser, if I right click under Cell(1,0) -> TextNode(0)->Textbox("username") and select "Highlight on Screen," it highlights in the browser with no problem. If I click "Map Object," it states it is already mapped to exactly what it is scripted to look for (in above lines 5 and 7).



If I then go into NameMapping, and drill down to the textboxUsername, Highlight on Screen produces "unable to find an object that matches," and if I attempt to remap, I get the error "The parent object hierarchy of the selected object does not match the expected hierarchy. Please re-map the object manually to reflect the changes."



My only guess right now is that it has something to do with the layout of the web site's panels, but I'd like to see if there are any workarounds.



As far as trying to program the script to "Click" in the textbox and then type, I am having issues with this as well because the recorded "Click" is clicking on that textbox, and TestComplete records the same textbox from line 7 above, then fails to find it during the runback of the script.



Any advice about how to remap this (if it is possible) or how to fix or force it to select these textboxes would be greatly appreciated.

1 Reply

  • It looks like I was able to fix this error.



    What is happening is the ObjectIdentifier property from the Object Browser is not being mapped correctly into Name Mapping. They're in a range from 0-3 and it is defaulting to 3 every time. I went into Name Mapping and manually edited the properties and was able to correct it.