Forum Discussion

Karthik_gowda's avatar
Karthik_gowda
Occasional Contributor
17 days ago

Assistance with Fetching Values from Grid Identified by 'AcuGridClass' property

Has anyone encountered a grid identified by the AcuGridClass property? If so, I need guidance on how to fetch a value, specifically from the status column, which could be 7th column for order status. Could you please advise on the best approach to retrieve this value? also code snippet in JS if any would help

  • 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_gowda's avatar
      Karthik_gowda
      Occasional 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 

       

       

      • JDR2500's avatar
        JDR2500
        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.