I’m automating an app and using winappdriver tool with java language for the same. I am selecting a row and clicking on that row in GUI. Here I am trying to delete a row. So I have a sequence number and with that sequence number I need to delete the row.
This is the snap of UI Spy :
Here sequence number value is 5, but I want to click the row 3.
//here loopng through each row by row..
String seqNoData=alEvents.get(i).sequenceNumber; //data (sequcenceNumber) from db
List<WebElement> pbp_insert = mainEntrySession.findElementByName(“DataGridView”).findElements(By.tagName(“./*[contains(@LocalizedControlType, ‘table’)]”));
List<WebElement> pbp_insert_grid_cells = pbp_insert.get(0).findElements(By.tagName(“./*[contains(@LocalizedControlType, ‘item’)]”));
// pbp_insert_grid_cells–contains all cellvalues
for(int cellIndex = 14;cellIndex < pbp_insert_grid_cells.size();cellIndex=cellIndex+17) //14 th column is sequence number
{
rowSequenceNo = pbp_insert_grid_cells.get(cellIndex).getText(); //read sequence number from gui
if(seqNoData==rowSequenceNo)
{
//sequence number 5==5 matching, how to get the sequence number row 3 and row 3 parent
//here how to fetch parent from child to click on that row..
}
Source: Read More