Facing problems in clicking an cell item in a table

Ask general questions here.
Sandeep1632
Posts: 11
Joined: Tue Apr 02, 2019 8:42 am

Facing problems in clicking an cell item in a table

Post by Sandeep1632 » Wed Feb 05, 2020 12:41 pm

Hi All,

We are trying to click on an cell team based on the condition that meets the cell text, Have used below code snippet to achieve this but however it is unable to click on that cell element. Could someone help us here.
Also attached the snapshot for the element that we trying to click
Code Module:
IList<Row> tableRows = adminRepo.DataSourceTable.Self.FindChildren<Row>();
foreach(Row tableRow in tableRows){
IList<Cell> rowCells = tableRow.FindChildren<Cell>();
foreach(Cell rowCell in rowCells){
if(rowCell.Text=="SQL Server"){
rowCell.Click();
break;
}
}
}

Thanks,
Sandeep
Attachments
TableCellClickSnapshot.rxsnp
(52 KiB) Downloaded 8 times

McTurtle
Posts: 297
Joined: Thu Feb 23, 2017 10:37 am
Location: Benedikt, Slovenia

Re: Facing problems in clicking an cell item in a table

Post by McTurtle » Wed Feb 05, 2020 1:07 pm

Hi Sandeep,

What does the debugger say? Where does it return an empty list of an exception?

Also, you have a lot of searching going on in that code, this will be "sloooooooow".
You maybe want to use a RanoreXPath that already limits the search to cells with "SQL Server" in the first place:
UniversalRanoreXPath.png
UniversalRanoreXPath.png (13.53 KiB) Viewed 157 times
This way you will need much less code and only one search:
LessSearches.png
LessSearches.png (4.48 KiB) Viewed 157 times
Try this. Does it work better?

If not, what does the debugger say?

Regards,
McTurtle