I have a Table created using <div> tags and with set of rows and each row has columns say col1, col2, col3, col4, col5 and col6.
col1 to col5 have some values and col6 is edit button.
Based on Col1 to col4 values sent as parameters , i have to click on Edit button and then do some action.
I have idea how to handle this through Selenium WebDriver.
Sample code will be as below:
// Find Table Web Element
WebElement tableEle = driver.findElement(By.xpath("\\div[@class='ui-grid-canvas']")
// Using Table WebElement find the list of Rows
List<WebElement> tableRows = tableEle.findElements(By.xpath("\\div[@ui-grid-row='row']"))
//Loop through each Row
for(int rnum=0;rnum<tableRows.size();rnum++)
{
//Get the Columns for each row
List<WebElement> tableColumns=tableRows.get(rnum).findElements(By.xpath("div[@role='gridcell']\div"));
count=0;
//loop through each column
for(int cnum=0;cnum<tableColumns.size();cnum++)
{
//verify the each column value with req values array , if matches increase the count otherwise come out of columns for loop
if((columns.get(cnum).getText()).equalsIgnoreCase(ReqValues[cnum]))
{
count++;
}
else
{
break;
}
// count is equal to column size -1 then matched all records click on the last column where edit icon exist and come out of rows for loop
if(count ==( tableColumns.size()-1))
{
columns.get((tableColumns.size())-1).click();
break;
}
}
}
I want to know, how the same code we can write using robot framework.
Get Elementkeyword but next onwards based on the element, how we can useGet Elementskeyword?, i think thatGet Elementskeywords will be likedriver.findElementsbut not onwebElement.findElements, there i stuck - Sarada Akurathitabletag but in my case, it created using<div>tag, so it is not working - Sarada Akurathi