Forum Discussion

vthomeschoolmom's avatar
vthomeschoolmom
Super Contributor
5 years ago
Solved

Get to a table ROW in Chrome

So I have some tests. Like a jerk, I did not test them on Chrome. Observe the following code:

 

// This value drives the DISPLAY of a selected row and demonstrates that it is or is not selected.
// This has only been proven for activity data grid. This needs to be proved on future grids.
function IsRowSelected(row)
{
	var rowClassName = row.className;
	if (rowClassName.includes("row-selected"))	
	{
		return true;
	}
	return false;
}

// Select desired cell. If not already selected, click it. (If
// it is already selected do not click as clicking will de-select.)
function SelectCell(table, rowIndex, colIndex)
{
	
	var row = table.Row(rowIndex);
	if (!IsRowSelected(row))
	{
	  	table.Cell(rowIndex, colIndex).scrollIntoView();
		aqUtils.Delay(ProjectSuite.Variables.TinyWaitTimeout); /// inconsistent error on click 
		table.Cell(rowIndex, colIndex).Click();
	}
}

Chrome does not expose a Row object. 

This works in Edge and IE. I have not tested Firefox yet, but it is next on my list.

Being able to access the Row by index is pretty cool. Is this just not accessible for certain browsers? 

Thanks

 

  • TanyaYatskovska's avatar
    TanyaYatskovska
    5 years ago

    Hi All,

    As far as I understand this question is related to this one. Let's keep the conversation there.

     

     

6 Replies

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    It is quite possible that some different markup without <tr> elements is provided for the Chrome browser.

    I would recommend to examine page structure displayed in Chrome using Object Browser and find out how exactly this given table is marked-up.

     

      • AlexKaras's avatar
        AlexKaras
        Champion Level 3

        Check if Rows collection is provided in the Object Browser. If it is, then you should be able to access rows using syntax like this:

        table.Rows.Item(i);