Selecting Cells in Infragistics UltraWebGrid

Applies to TestComplete 15.10, last modified on December 15, 2021

One of the actions that you will perform the most over a grid is selecting cells. This topic describes the approach which can be used to select a particular cell in Infragistics UltraWebGrid. Note that before selecting a cell, you need to identify the row and the column where the needed cell resides. For example, you can search for the row by the value or text in a particular column.

When testing UltraWebGrid controls, use specific methods and properties of the corresponding InfragisticsWebDataGrid object. In order for TestComplete to be able to access this object, the Infragistics Control Support plugins must be installed and enabled. You can call object methods and properties from your keyword tests, as well as from scripts. This topic describes how to work with object properties and methods from your scripts. However, when testing a GridGroupingControl control from your keyword test, you can use the same methods and properties calling them from keyword test operations. For more information, see Keyword Tests Basic Operations.

You can select cells by simulating clicks. To simulate clicks on UltraWebGrid cells, you can use the ClickCell, ClickCellR, DblClickCell and similar actions of the InfragisticsWebDataGrid or InfragisticsWebDataGridView object. All of these actions have parameters that specify the row and the column that contain the needed cell. They also have an additional parameter which specifies the key or a combination of keys (Ctrl, Alt, Shift) that are pressed when simulating a click.

The following example works with the WebDateChooser - DateChooser in Grid sample application, which is part of the Infragistics NetAdvantage 2009 trial download package.

JavaScript, JScript

function Main ()
{

  var url = "http://my-web-site/web-page-with-ultrawebgrid-2009.aspx";
  Browsers.Item(btIExplorer).Run(url);
  var page = Sys.Browser("*").Page("*");

  // Obtain the grid object
  var grid = page.Frame("contentBodyIFrame").Frame("main").Form("Form1").Table("igtabUltraWebTab1").Cell(1, 0).Frame("UltraWebTab1_frame0").Form("Form1").Table("Table1").Cell(0, 0).Table("Table2").Cell(1, 0).Table("UltraWebGrid1_main");

  // Obtain and select the cell
  var RowIdx = 1;
  var ColumnName = "First Name";

  // Simulate a click on the cell
  grid.ClickCell (RowIdx, ColumnName);
}

Python

def Main ():

  url = "http://my-web-site/web-page-with-ultrawebgrid-2009.aspx"
  Browsers.Item[btIExplorer].Run(url)
  page = Sys.Browser("*").Page("*")

  # Obtain the grid object
  grid = page.Frame("contentBodyIFrame").Frame("main").Form("Form1").Table("igtabUltraWebTab1").Cell(1, 0).Frame("UltraWebTab1_frame0").Form("Form1").Table("Table1").Cell(0, 0).Table("Table2").Cell(1, 0).Table("UltraWebGrid1_main")

  # Obtain and select the cell
  RowIdx = 1
  ColumnName = "First Name"

  # Simulate a click on the cell
  grid.ClickCell (RowIdx, ColumnName)

VBScript

Sub Main
  Dim url, page, grid

  url = "http://my-web-site/web-page-with-ultrawebgrid-2009.aspx"
  Browsers.Item(btIExplorer).Run url
  Set page = Sys.Browser("*").Page("*")

  ' Obtain the grid object
  Set grid = page.Frame("contentBodyIFrame").Frame("main").Form("Form1").Table("igtabUltraWebTab1").Cell(1, 0).Frame("UltraWebTab1_frame0").Form("Form1").Table("Table1").Cell(0, 0).Table("Table2").Cell(1, 0).Table("UltraWebGrid1_main")

  ' Obtain and select the cell
  RowIdx = 1
  ColumnName = "First Name"

  ' Simulate a click on the cell
  Call grid.ClickCell (RowIdx, ColumnName)
End Sub

DelphiScript

procedure Main;
var url, page, grid : OleVariant;
begin
  url := 'http://my-web-site/web-page-with-ultrawebgrid-2009.aspx';
  Browsers.Item(btIExplorer).Run(url);
  page := Sys.Browser('*').Page('*');

  // Obtain the grid object
  grid := page.Frame('contentBodyIFrame').Frame('main').Form('Form1').Table('igtabUltraWebTab1').Cell(1, 0).Frame('UltraWebTab1_frame0').Form('Form1').Table('Table1').Cell(0, 0).Table('Table2').Cell(1, 0).Table('UltraWebGrid1_main');

  // Obtain and select the cell
  RowIdx := 1;
  ColumnName := 'First Name';

  // Simulate a click on the cell
  grid.ClickCell (RowIdx, ColumnName);
end;

C++Script, C#Script

function Main ()
{

  var url = "http://my-web-site/web-page-with-ultrawebgrid-2009.aspx";
  Browsers["Item"](btIExplorer)["Run"](url);
  var page = Sys["Browser"]("*")["Page"]("*");

  // Obtain the grid object
  var grid = page["Frame"]("contentBodyIFrame")["Frame"]("main")["Form"]("Form1")["Table"]("igtabUltraWebTab1")["Cell"](1, 0)["Frame"]("UltraWebTab1_frame0")["Form"]("Form1")["Table"]("Table1")["Cell"](0, 0)["Table"]("Table2")["Cell"](1, 0)["Table"]("UltraWebGrid1_main");

  // Obtain and select the cell
  var RowIdx = 1;
  var ColumnName = "First Name";

  // Simulate a click on the cell
  grid["ClickCell"] (RowIdx, ColumnName);
}

See Also

Working With Infragistics UltraWebGrid
ClickCell Action (Grid Controls)
Obtaining and Setting Cell Values in Infragistics UltraWebGrid

Highlight search results