Forum Discussion

PrathyushaCH's avatar
PrathyushaCH
Occasional Contributor
29 days ago

Is it possible to extract data from the cells of a grid which is not getting identified as a table

Hi,

Please suggest a way to get the cell values of a grid where object spy is not identifying it as a table neither row nor column count are also not identified. 

Thanks!

  • Hi,

    I have dealt with this issue before with several different grid controls.  Two approaches have worked for me.

    Approach number one only works if you can manually select individual cells, or groups of cells, using your mouse.  It also requires that you are able to move through the cells using arrow keys on the keyboard.  Lastly, you must have the ability to copy the cell contents to the clipboard.  So the sequence would go something like this if for instance you wanted to verify the value in row 2, column 2 using a script:

    1. Click in the top left corner of the grid to select cell 1,1, or the column header if it has one,  <grid control object>.Click 5, 5
    2. Send keystrokes to move to the target cell <grid control object>.Keys("[Right][Down]")
    3. Copy the cell contents to the clipboard using keystrokes <grid control object>.Keys("^c")
    4. Verify the value with a clipboard checkpoint:  Clipboard Checkpoints | TestComplete Documentation (smartbear.com)

    Provided the grid responds to keystrokes you can select and verify multiple contiguous cells by using the Shift key in combination with the arrow keys.

    If you can't work with the grid control in the manner described above, then approach number two may be your best option.  That approach uses the IQ Add-in to recognize the table and provide access to the cells.  The downside of that approach is the extra expense of the IQ Add-in and requirement that all your test environments have external internet access.

    Here is a link to the help topic for using that method:  OCRTable Object | TestComplete Documentation (smartbear.com)

    Best regards,
    John

  • PrathyushaCH's avatar
    PrathyushaCH
    Occasional Contributor

    These are the properties of the grid. It has 2 rows and 5 columns.

     

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    Just wItemCount and no other properties? Can you take a screenshot of the Object Spy tool for your control

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    What properties are exposed, when using Object Spy tool?