Forum Discussion

lalit_singh's avatar
lalit_singh
Contributor
3 years ago

Identifying index position in listbox and then clicking it

I am having test complete version 11.31 and automating a dephi application using python

there is an listbox and I need to select one of the index position in list and then click it 

Please let me know how it can be possible

 

 

7 Replies

  • Marsha_R's avatar
    Marsha_R
    Champion Level 3

    See how some of the rows in Object Spy have the three dots at the end?   You can click on those and drill down farther.  Your index will probably show up in one of those.

    • lalit_singh's avatar
      lalit_singh
      Contributor

      Yes;

      Values in listbox are getting shown in the object

      When I am trying to select the item, it works for the first 3 indexes in list

      but then gives in incorrect result

      Code================================

      childIndex = 7
      #half of the width
      xPos = ListBox.Child(childIndex).BoundingRectangle[2]//2
      # (Screen Top of child - Screen Top of List Box) + Half of the height of child
      yPos = (ListBox.Child(childIndex).BoundingRectangle[1] - ListBox.BoundingRectangle[1]) + (ListBox.Child(childIndex).BoundingRectangle[3])//2
      ListBox.Click(xPos, yPos)
      #***works Partially end****

      • Marsha_R's avatar
        Marsha_R
        Champion Level 3

        If you have the index of the item, then I don't think you need the x,y positions.  You can access the object by name, something like

        MyObject(2).Click