Forum Discussion

Ragusa's avatar
Ragusa
Occasional Contributor
10 years ago

ClickItem TextBlock

With ClickItem I can use an index or a name. Can I use also a TextBlock of an WPFObject? On my application I've to use index "43" to get the date "08/2015". It works right now, but when the application will be changed, index "43" can lead me to a total different date. So, I rather like to use "08/2015". I can see this date in my ComboBox: ...ComboboxProfitcenter.WPFObject("TextBlock", "08/2015", 1). How can I use this TextBlock to adjust my ComboBox?

 

Thank you and God bless you

2 Replies

  • Ravik's avatar
    Ravik
    Super Contributor

    ClickItem action allows you to select any item specified by its index or caption.

    selects an item with the caption 08/2015, then selects the 43 item in the combo box:


    Set ComboBox = WPFObject("TextBlock", " ", 1)
     
      'Select items

      ComboBox.ClickItem "08/2015"
      ComboBox.ClickItem (43)

     

    This may help you.

    • Ragusa's avatar
      Ragusa
      Occasional Contributor

      Thank you for helping me with this issue. I tried to follow your advice and coded the following using JScript:

       

      function Test7()
      {
        var arrFeld  = ["Mandant", "102 WB Zürich"];
        var comboMandant = Aliases.WaloMIS.HwndSource_MainWindow.MainWindow.ContentControl.mainContentControl.UsrParametrizedReportViewer.UsrparameterpanelSystemWindowsControlsItem.ItemsControl.GroupItem.ItemsControl.ComboboxMandant;
        var comboMandantWPFObject = Aliases.WaloMIS.HwndSource_MainWindow.MainWindow.ContentControl.mainContentControl.UsrParametrizedReportViewer.UsrparameterpanelSystemWindowsControlsItem.ItemsControl.GroupItem.ItemsControl.ComboboxMandant.WPFObject("TextBlock", " ", 1);
        comboMandantWPFObject.ClickItem (arrFeld[1]);
      }

       

      But on coding variable "comboMandantWPFObject" TestComplete checks this already against my application and reports "Unable to find the object WPFObject("TextBlock", " ", 1)" since there isn't a blank text but "Alle".

      Regarding the "ClickItem" TestComplete says "The object does not exist" because it doesn't see my "102 WB Zürich" on the WPFObject Textblock but "Alle". If I use the index number 2 instead of "102 WB Zürich", it works. Is my code wrong?