Ask a Question

Identifying index position in listbox and then clicking it

lalit_singh
Occasional Contributor

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

lalit_singh_0-1632292801823.png

 

 

7 REPLIES 7
Marsha_R
Community Hero

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.


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
lalit_singh
Occasional 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****

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

 

 


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
lalit_singh
Occasional Contributor

Hello Marsha;

I am having older version of test complete , there click() function on index is not available

 

If you record a test that clicks on one of the entries in the listbox, what code does it give you for that click?


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
lalit_singh
Occasional Contributor

it gives the click() function with coordinates but that is not working 

sonya_m
SmartBear Alumni (Retired)

Thank you, Marsha!

Hi @lalit_singh! If none of the suggestions from the Community helped, please open a support ticket.


Sonya Mihaljova
Community and Education Specialist

cancel
Showing results for 
Search instead for 
Did you mean: