Forum Discussion
I have worked with a variety of grids in desktop applications but not anything by that name. Hopefully I'm not telling you what you already know.
There are two scenarios I often encounter:
a) TC recognizes the grid as a grid and provides access to the contents (e.g. cells, rows, columns, etc.) via various properties and methods that can be viewed using the object spy as seen below and utilized in scripts.
The wValue property, as seen above, will let you get any cell value by specifying the row (by index only) and column (either by index or header text).
The indexes are zero-based so the seventh column would be 6. You could get the value of the first cell in that column something like this:
value = mygrid.wValue 0, "Status"
or using indexes:
value = mygrid.wValue 0, 6
b) TC doesn't recognize the grid and therefore the grid related properties and methods don't work. In this case I have used the ugly solution of clicking in the top left cell of the grid (e.g. mygrid.Click 5,5) and then sending arrow keystrokes (e.g. mygrid.Keys("[Right][Right][Down]") to navigate to the cell with the value I want to verify. Once the cell is selected, I copy the value to the clipboard (e.g. mygrid.Keys("^c") and verify it with a clipboard checkpoint. Sorry I only do VBScript.
If (aqString.StrMatches("27", Aliases.Sys.Clipboard) = True) Then
Call Log.Checkpoint("The value is correct.")
Else
Call Log.Warning("The expected value was not found")
End If
The second method I've used when TC doesn't recognize the grid is the IQ Add-in. It can recognize tables and contained values. Here is a link to the relevant help topic:
OCRTable Object | TestComplete Documentation (smartbear.com)
Again, I apologize in advance if all of this is already known to you.
- Karthik_gowda4 months agoOccasional Contributor
Thanks for your inputs. Yes, this approach was my initial plan, however , unfortunately wValue is not a property of the grid , also tried using rowCount and Cellvalue, also not a property and there are no child for the grid , I apologize for not giving this information earlier, attached the screenshot and available properties for this
- rraghvani4 months agoChampion Level 3
Ask your developers, what technology they use for the application. Then check if it's supported by TC via https://support.smartbear.com/testcomplete/docs/general-info/supported-technologies/index.html
- JDR25004 months agoFrequent Contributor
I think that grid control is from ACUCOBOL, formerly a Microfocus product. I couldn't find anything about it in the TC docs. I'm guessing it's not supported.
- JDR25004 months agoFrequent Contributor
I was afraid that was the case. That's the scenario where I've either had to rely on keystrokes to navigate through the grid or the AQ Add-in to recognize its contents.
Using keystrokes will only work if you can give focus to a single cell by clicking it, the grid will respond to arrow keys to move from cell to cell and that the contents can be copied to the clipboard using Ctrl-c.
If the keystroke approach isn't an option, then the IQ add-in is probably your best bet. It's not amazing but it will work in many cases. The downsides are the additional expense and it requires an internet connection from all the client machines running TestExecute or TestComplete.
Related Content
- 11 months ago
- 3 years ago
- 9 years ago
- 5 years ago
Recent Discussions
- 18 hours ago
- 18 hours ago
- 5 days ago