Ask a Question

Not able to add objects like "OCR.Recognize(Aliases.EXCEL...).BlockByText("..ook")" to Name Mapping

SOLVED
harmatii
Occasional Contributor

Not able to add objects like "OCR.Recognize(Aliases.EXCEL...).BlockByText("..ook")" to Name Mapping

Using TestComplete to create automate Excel Addins I have trouble to save my objects to Name Mapping

 

OCR.Recognize(Aliases.EXCEL.wndExcel.EXCEL2.toolbar.Ribbon.NUIPane.NetUIHWND).BlockByText("Home").Click()
OCR.Recognize(Aliases.EXCEL.wndExcel.EXCEL2.toolbar.Ribbon.NUIPane.NetUIHWND).BlockByText("Insert", spLeftMost).Click()
OCR.Recognize(Aliases.EXCEL.wndExcel.EXCEL2.toolbar.Ribbon.NUIPane.NetUIHWND).BlockByText("Page Layout").Click()
OCR.Recognize(Aliases.EXCEL.wndExcel.EXCEL2.toolbar.Ribbon.NUIPane.NetUIHWND).BlockByText("Formulas").Click()
OCR.Recognize(Aliases.EXCEL.wndExcel.EXCEL2.toolbar.Ribbon.NUIPane.NetUIHWND).BlockByText("Data").Click()
OCR.Recognize(Aliases.EXCEL.wndExcel.EXCEL2.toolbar.Ribbon.NUIPane.NetUIHWND).BlockByText("Review").Click()
OCR.Recognize(Aliases.EXCEL.wndExcel.EXCEL2.toolbar.Ribbon.NUIPane.NetUIHWND).BlockByText("View", spNearestToCenter).Click()
OCR.Recognize(Aliases.EXCEL.wndExcel.EXCEL2.toolbar.Ribbon.NUIPane.NetUIHWND).BlockByText("Help").Click()

 

TestComplete is not adding this objects automatically to the Name Mapping.

3 REPLIES 3
tristaanogre
Esteemed Contributor

OCR.XXXX objects are not onscreen objects therefore they will not be added to NameMapping.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
harmatii
Occasional Contributor

What way would you recommend to store objects like that? 

tristaanogre
Esteemed Contributor

You don't.  At least, not in NameMapping.

NameMapping is for recognizing, finding, and identifying objects on screen for interaction in the automation.  If you're doing OCR.Recognize, that's returning an object, sure, but it's not a UI object.  So, you would use your standard coding technique of assigning to some sort of variable.  You could create an array and "push" each one to an element in the array.  You could create a dictionary and added a key/value pair for each object... all sorts of methods for storing the object during code execution.

 

But you would NOT use NameMapping.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
cancel
Showing results for 
Search instead for 
Did you mean: