Forum Discussion

LAB's avatar
LAB
Contributor
6 years ago
Solved

A tale of two popups

Running a keyword test here, am wondering if it's possible to solve this without code.

 

I'm dealing with two popup windows on our website, one is start date, the other is end date. Both pop ups visually look exactly the same, but the problem is the idstr (which testcomplete is using to identify) is dynamic. Meaning it'll come up as cdk-overlay-1 the first time I identify start date, and overlay 2 the second time, or maybe end date will be overlay 1 the next time...

 

So I set idStr as cdk-overlay-*.... The problem is then that it identifies the objects ambiguously. Also if try to just delete one of the mappings and use cdk-overlay-* for both pop ups, it can only identify 1...even though the only identifier I'm using for both ObjectType Panel, and idStr cdk-overlay-*, and they both exist in the same spot in the mapping hierarchy.

 

I've looked at all the secondary properties, the only ones that are unique, are the ones that are dynamic, and using offset is extremely fragile.

 

Anyone know how I can either use the same mapping for both, or somehow differentiate between the two and still account for dynamic objects?

 

thanks for your time!

  • Hi,

     

    Unless I missed something in your question... It is my understanding that both cdk-overlay-* popups exist on the page (thus causing objects ambiguity recognition) but only one of them is visible at the given moment of time. If the above is correct, does it help if additional Visible=True identification property is added to NameMapping?

    (In the case if both cdk-overlay-* elements have Visible property set to true or false, you may consider to use Required Child functionality of NameMapping.)

  • It has to do with caching of mapped object, I believe. To improve performance, TestComplete caches a mapped object so that, if it is used more than once in the same test case, it doesn't have to be "found" again.  So, what is probably happening is that the first time it is used, it gets the handle for the "start date" generated object and caches that.  When you click the button for end date, it tries to use the cached value and probably gets lost in the process.  A potential solution to this, if you're using the same mapped object more than once in a test case and there is a potential for it to be destroyed, recreated, reconfigure, etc., to call "RefreshMappingInfo" on that object before you try using it the second time.

6 Replies

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    Unless I missed something in your question... It is my understanding that both cdk-overlay-* popups exist on the page (thus causing objects ambiguity recognition) but only one of them is visible at the given moment of time. If the above is correct, does it help if additional Visible=True identification property is added to NameMapping?

    (In the case if both cdk-overlay-* elements have Visible property set to true or false, you may consider to use Required Child functionality of NameMapping.)

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      You might also try adding something like the contentText property, wild-carded, to look for "start date" and "end date" in the text of the pop-up.  There may be other properties that contain unique information as well such as className or innerHTML or something like that which may contain a style or other bit of text string that will uniquely identify the object.

  • LAB's avatar
    LAB
    Contributor

    tristaanogre- I may have been a little vague in my description, these popups are originated from a start date and end date calendar button, but when they pop up they are generic in description, including any sub text unfortunately. Thanks for the response!

     

    AlexKaras - This seems to have worked, at least in preliminary tests, thanks for the response!

     

    I'm still a little confused as to why two objects in the same spot in hierarchy (in this case main window), with the same identifiers

     

    ObjectType: Panel

    idStr: cdk-overlay-*

    VisibleOnScreen: True

     

    are unable to be identified on screen with 1 name mapping entry. Is testcomplete looking at other object properties outside of the 3 being used?