Forum Discussion

presideji_1's avatar
presideji_1
New Contributor
7 years ago

Can anyone give a guide on on to code(in Jscript) the selection of items in an Accordion?

Can anyone give a guide on how to code(in J script) the selection of items in an Accordion?

6 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Screenshot of the object does not give us enough information to go on in order to give you the help we need.  We need to see the component itself as shown in the Object Browser of TestComplete with the full list of available properties and methods.

     

    Alternatively.... what happens when you record on the object?  A good way of figuring out how TestComplete will interact with your object is to do a quick record against it to see what happens.

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        OK, as for the Accordian component, I'm not sure what native support TestComplete can offer to work with it other than the basics of Click and Keys.  I'd have to examine the properties a bit more closely.  What do you need to do with it?

         

        As for the rest of your document... that's object recognition errors.  The "Object does not exist" type errors you report are a problem with the accordion object itself but, as the errors indicate, one of the parent objects in the hierarchy is not being identified properly.

         

        Aliases.browser.pageConstructionline.panelAppInitPageLoaded.panel.panel.section

         

        You need to take a look at the mapping of that object, the properties being used, and adjust those properties so as to make a reliable identification.  As is mentioned frequently here on this community, while the automatic mapping of objects by TestComplete is a good starting point, almost ALWAYS you should go back and rework the mapping to be more reliable.  My guess is that the "section" object indicated is using some sort of property that changes dynamically from test run to test run and so cannot be identified.  Alternatively, there may be more than one "section" in the hierarchy that matches the properties so TestComplete gets the first one it finds which might not be the proper one.  You should go through the entire hierarchy of your object tree and validate the properties being used to map the component so as to give a good, reliable mapping.  Please read through https://support.smartbear.com/testcomplete/docs/testing-with/object-identification/name-mapping/overview.html for everything there is to know about NameMapping.

         

        Side note...

         

        While the NameMapping of the item can remain

         

        NameMapping.Sys.browser.pageConstructionline.panelAppInitPageLoaded.panel.panel.section.panelContainer.panelRow.formFormNgPristineNgValidNgValid.panelAccordiongroup9428Tab.panelAccordionHd

         

        You really should edit your Alias.  The only true parts of the Alias that are meaningful are as follows, just as a best guess

         

        Aliases.browser.pageConstructionline.panelAccordionHd

         

        This will make your application test much more manageable.