Forum Discussion

Researcher's avatar
Researcher
New Contributor
5 years ago

Mouse click not proper

I am using Test complete for desktop application testing.

While recording  in the grid view, click on particular cell and edited the value. But Playback is run It is selecting different cell.

how to  make it  click on proper cell and edit the value.

  • zarcher's avatar
    zarcher
    4 years ago

    I was able to solve this issue by using the page down key. In my example the grid value I needed to edit was at the bottom of the page. I paged down until the value was in view and then made the edit. This allowed the grid in view to have the exact same setup every time. Only problem with this is if the grid changes (values added or removed) you will need to update your script.

  • anupamchampati's avatar
    anupamchampati
    Frequent Contributor

    Use this function to click on Grid, just modify a little bit according to the property of your grid
    I have posted the overview of clickGrid function .

    Para 1 : Grid - Object of the Grid
    Para 2: Column name you want to click in
    Para 3 : Cell Value to click 
    function ClickGrid(Grid,Column,Value)
    {
    var RowIndex;
    function FindRow(Grid, Column, Value, ViewId)
    {
    if (typeof(ViewId) == "undefined")
    ViewId = 0;
    for (var i=0; i<Grid.wRowCount(ViewId); i++)
    if (Grid.wValue(i, Column, ViewId) == Value)
    return i;
    return -1;
    }
    RowIndex = FindRow(Grid,Column,Value);
    if (RowIndex != -1)
    {
    Grid.ClickCell(RowIndex, Column);
    Log.Message("Row index: " + RowIndex + " Column Name: " + Value);
    }
    else
    Log.Error("Row was not found");
    }

    • Researcher's avatar
      Researcher
      New Contributor

      Mouse click problem occurs only in flex grid.

      For the data grid in the application scroll bar set and mouse click correctly click the grid cell
      But for the Flex grid in the application the scroll bar is set ,grid is unchanged and mouse click for different cell.

      For the data grid unit script have this:
      WindowsForms10Window8app0141b42ar11ad1.MouseWheel(-11)

      And for Flex grid the unit script is :
      VBFlexGridWndClass.VScroll.Pos = 6

      How can this be solved?

      • zarcher's avatar
        zarcher
        Occasional Contributor

        I was able to solve this issue by using the page down key. In my example the grid value I needed to edit was at the bottom of the page. I paged down until the value was in view and then made the edit. This allowed the grid in view to have the exact same setup every time. Only problem with this is if the grid changes (values added or removed) you will need to update your script.