Forum Discussion

d44's avatar
d44
New Contributor
12 years ago

WPF Grid (windows presentation form) search

Hi,



I'm trying to find which row/cell contains specific text by searching the second column of each row.  I am using WaitProcess and .Exists (JScript) and then incrementing the row number if not found in that row, but it just stops the test if the text was not in the first row for some reason (Unable to find the object WPFObject("DataGridCell", "SOME TEXT", 2).



Does anyone have any idea what I might be doing wrong?




  findText = "SOME TEXT"

  rowNumber = 1;

  itemFound = false;

  

  

  // Select row

  while (itemFound == false)

  {

    if (Sys.WaitProcess("......")..............WPFObject("DataGridRow", "", rowNumber).WPFObject("DataGridCell", findText, 2).WPFObject("TextBlock", findText, 1).Exists == true)

    {

      Sys.Process("......")..............WPFObject("DataGridRow", "", rowNumber).WPFObject("DataGridCell", findText, 2).WPFObject("TextBlock", findText, 1).Click();

    }

    else

      rowNumber++; 

  }