Forum Discussion

WesWhit's avatar
WesWhit
Contributor
6 months ago

Textbox not found during test

I'm having a little trouble with a textbox on a WPF app. When I map it during record it fine and I can update the properties in the name mapping fine with the app open. These 2 thing can find the textbox as can the object spy and object mapper. The issue comes when I  run the test, I use SetText, and I get an error to say that the object does not exist even though it is clearly there on the page. Has anyone has this issue before? intelligent fix doesn't work. I am starting think it may be a TestComplete bug. 

any help is greatly appreciated, thank you.

  • You have, what looks like, two identical dialogs. The only difference being the dialog caption name, one being "Detail for 'Asset 1test'" and the other being "Detail for 'Asset1'". 

    You need to manually create a name mapping for the dialog, using wildcard, e.g. "Detail for *" and then manually create the name mappings for Name, Type, Head etc controls.

    It's vital that you understand how Object Identification works in TC, and ensure you fully understand Name Mapping

    During record and playback, TC will map them separately, because the parent object being the dialog, has different caption names.

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    What properties and property values have you chosen, in your name mapping, for the textbox?

  • I have tried the WPFControlName (TestComplete chose this) , ClrClassName, and Name. I have tried each one on it's own and all together/combinations. more info this is a previously existing textbox that work, the whole window was redesigned, but the properties never changed. I have tried remapping deleting everything to do with it and trying again but nothing is working. 

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    To simulate user actions on an object in your tested application, you first need to identify the object, that is, to instruct TestComplete on how to locate the object in your tested application. Using name mappings, textboxInstasearch has the following values to identify the control ObjectType = Textbox, idStr = instasearch

    I understand that it's not working, but I'm trying to understand what properties and property values have been chosen. 

  • this is the edit window name textbox that doesn't work, I belive it is identical to the creation name box (below) but TestComplete thinks they're different so maps them separately. this is the one that doesn't work, it can be mapped and the name mapping can be edited but during the text is says it doesn't exist.

    this the the creation name box which works fine this is how the other was set up originally, and I have tried to use this one for the other as they are identical but it doesn't work.

      

    This is the function that calls them.

    This is the test result saying it doesn't exist when it is clearly there.

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    You have, what looks like, two identical dialogs. The only difference being the dialog caption name, one being "Detail for 'Asset 1test'" and the other being "Detail for 'Asset1'". 

    You need to manually create a name mapping for the dialog, using wildcard, e.g. "Detail for *" and then manually create the name mappings for Name, Type, Head etc controls.

    It's vital that you understand how Object Identification works in TC, and ensure you fully understand Name Mapping

    During record and playback, TC will map them separately, because the parent object being the dialog, has different caption names.

  • rraghvaniThank you, yes the mapping for the dialog window 2 levels above had a property 'WindowCaption' that referenced 'Details for ...' I deleted it and the one nameText worked for both windows.