Unable to find object in a grid in Windows application
For my test I need to validate the color of an icon placed in a grid. Objectspider recognizes the grid but not more than that (icons, cells etc) within the grid are not detected. Advanced view doesn't help me either with detecting elements within the grid.
In this specific case, I would like to validate the color of the 'phone' icon in the grid, in this case it's black.
Any help or tips are appreciated.
When you use Object Spy to identify your grid, do you have a property called "wValue" or something like that as part of the grid? It probably has a button called "Params" next to it. So you might be able to use something like:
That might get you access the cell itself, but then we still need to verify what you actually need to verify. I can't find a "color" property in the grids I use, but I'm wondering if there are any other differences between the 'phone' icons you need to differentiate between. If there is a difference in size (my 'read' icon is 20 pixels wide, but my 'unread' is only 15), you could use
if(myGrid.wValue(2,0).Width==15) //do something
But once you can look into the cell values, you might be able to find some other differences that, while not technically telling you if the color of your image is black, might still tell you what you need to know. For example, if you're REALLY lucky, the devs might have used the "Tag" property to differentiate between different phone statuses or types or whatever.
thanks for the answer but unfortunately I do not have any "Value" (or something like that) property.
Can't access any individual cell in the grid either 😞
Is there another approach I could use?
Is there a specific setting in TC I could change/should change to get "access" to the specific lines/columns/cells?
What kind of grid is it? (class name will likely tell you)
With the Delphi grids I've been using recently, they use columns/rows/fields/items in the properties and an underlying dataset (datalink > dataset) object as the grid is linked directly to a DB. For some things, you can get from the grid properties, for others, I need to look at the underlying dataset ...
Not a type I've ever had to deal with unfortunately.
Sounds like it's a list view rather than a grid though. Does it allow you access to it's native methods? Which I suspect may be similar to these: https://msdn.microsoft.com/en-us/library/aa296191(v=vs.60).aspx
Maybe have a look here: https://support.smartbear.com/viewarticle/76025/
And see if anything in there (or the other pages on working with list views) helps.
Probably worth speaking to the developers as well to see if there is anything custom/non-standard about it. If there is, associating the class to the base class may help.