Forum Discussion

kpinnisetti's avatar
kpinnisetti
Contributor
11 years ago

ClickItem not available for the Select2 dropdown

Hi , In our application we are using the Select2 drop down, where test complete is not recognizing it as a dropdown.

I have submitted a ticket before about this, and  they said they don't support this.

I'm wondering now if they have come up with any patches for this or with the latest version it works.

Below is the example link where we are using the same dropdown in our application too.



http://www.ok-soft-gmbh.com/jqGrid/UsageFormetterSelect2.htm
  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)
    Hi Keerthana,

     


    As you are testing web pages - TestComplete can recognize all objects on the page. So, you can use your own ClickItem function. For example, the code below demonstrates how to click the Mimbai item on the sample you provided:


     




    function test()


    {


      var page = NameMapping.Sys.Browser().Page("http://www.ok-soft-gmbh.com/jqGrid/UsageFormetterSelect2.htm");


      MyClickItem(page, "Mumbai");


    }  


     


    function MyClickItem(page, itemText)


    {


      var panel = page.Panel("gbox_list");


      // Click the combo box to open the dropdown 


      panel.Panel("gview_list").Panel(1).Panel(0).Table(0).Cell(1, 2).Panel(0).Table(0).Cell(0, 1).Panel("s2id_gs_CITY").Link(0).Click();


        // Update the object tree. You can find the nearest parent of the dropdown to refresh it. In your example, it's "page" 


      page.Refresh();


      // Wait while the dropdown is fully recognized


      if (page.WaitPanel("select2_drop", 3000))


      {


        // Find the needed item by unique properties. "Mumbai" in this case.


        var PropArray = new Array("ClassName", "contentText");


        var ValuesArray = new Array("select2-result-label", itemText);


        var item = page.Panel("select2_drop").FindChild(PropArray, ValuesArray, 5);


        // Click the found item


        item.Click()


      }


    }