04-05-2018, 05:10 PM
(This post was last modified: 04-05-2018, 05:12 PM by Devesh Thakur.)
I'm automating tests for a desktop application on Windows platform.
In a WinListView control which is used to display a multi-valued list(Each row in the list has four columns in it). After hovering on each row to select it, when mouse click operation is performed on any of the four cells the respective control in that cell shows up(an editbox or a dropdown list)
It seems that the developers have embedded temporary WinEdit and WinComboBox controls in the cells of each row which makes it difficult to use Object spy on them. I succeeded in getting object spy to work on those by holding control key, but the properties of those objects are not unique, for instance ComboBox in the third cell in different rows has the same properties.Posting ObjectSpy results here.
I have tried selecting rows using WinListView.GetItem but that gives hold of the first cell only which is an editbox and it works. For the remaining three columns I can't find any workaround. I have tried performing clicks using WinListView.GetItem().Select operation providing offset in pixels to click on each cell but that doesn't activates the embedded controls although I see the mouse moving and performing clicks when the test runs.
Record and play didn't provide much insight either as the play operation doesn't replicate the actions successfully every time and uses same and generic names for actions on cells of different rows.
In a WinListView control which is used to display a multi-valued list(Each row in the list has four columns in it). After hovering on each row to select it, when mouse click operation is performed on any of the four cells the respective control in that cell shows up(an editbox or a dropdown list)
It seems that the developers have embedded temporary WinEdit and WinComboBox controls in the cells of each row which makes it difficult to use Object spy on them. I succeeded in getting object spy to work on those by holding control key, but the properties of those objects are not unique, for instance ComboBox in the third cell in different rows has the same properties.Posting ObjectSpy results here.
Quote:Code:**ComboBox in Row 1 Cell 3**
"Class Name:=WinComboBox",
"abs_x:=1041",
"abs_y:=551",
"all items:=Hours\nMinutes",
"attached text:=",
"enabled:=True",
"focused:=True",
"height:=21",
"hwnd:=7602202",
"items count:=2",
"nativeclass:=ComboBox",
"object class:=ComboBox",
"regexpwndclass:=ComboBox",
"regexpwndtitle:=Minutes",
"rightaligned:=False",
"righttoleftlayout:=False",
"righttoleftreading:=False",
"selection:=Minutes",
"text:=Minutes",
"visible:=True",
"width:=90",
"window id:=7988488",
"windowextendedstyle:=0",
"windowstyle:=1342177987",
"x:=354",
"y:=257"
Code:
**ComboBox in Row 5 cell 3**
"Class Name:=WinComboBox",
"abs_x:=1041",
"abs_y:=619",
"all items:=Hours\nMinutes",
"attached text:=",
"enabled:=True",
"focused:=True",
"height:=21",
"hwnd:=11601852",
"items count:=2",
"nativeclass:=ComboBox",
"object class:=ComboBox",
"regexpwndclass:=ComboBox",
"regexpwndtitle:=Minutes",
"rightaligned:=False",
"righttoleftlayout:=False",
"righttoleftreading:=False",
"selection:=Minutes",
"text:=Minutes",
"visible:=True",
"width:=90",
"window id:=7988488",
"windowextendedstyle:=0",
"windowstyle:=1342177987",
"x:=354",
"y:=325"
I have tried selecting rows using WinListView.GetItem but that gives hold of the first cell only which is an editbox and it works. For the remaining three columns I can't find any workaround. I have tried performing clicks using WinListView.GetItem().Select operation providing offset in pixels to click on each cell but that doesn't activates the embedded controls although I see the mouse moving and performing clicks when the test runs.
Record and play didn't provide much insight either as the play operation doesn't replicate the actions successfully every time and uses same and generic names for actions on cells of different rows.
Code:
WinListView("WinListView Name").WinEdit("Edit").Set "20"
DialogObject.WinComboBox("ComboBox").Select "Hours"