Web table is a different type of web element and we can not directly get all data in one variable.
To access web table data we need to locate web table using findelement method and then identified all the tr tags using findelements method.
Code for the same as below.
WebDriver driver = new InternetExplorerDriver();
WebElement table = driver.findElement(By.id("tableid));
List<WebElement> tablerows = table.findElements(By.tagName("tr")); // To get all Rows
int rowcount = tablerows.size(); \\To get count of total rows
for (WebElement tablerow : tablerows )
{
tablerowindex = 0;
List <WebElement> tablecolumns = tablerow.findelements(By.tagName("td"));
int columncount = tablecolumns.size();
for (WebElement tablecolumn : tablecolumns)
{
}
To access web table data we need to locate web table using findelement method and then identified all the tr tags using findelements method.
Code for the same as below.
WebDriver driver = new InternetExplorerDriver();
WebElement table = driver.findElement(By.id("tableid));
List<WebElement> tablerows = table.findElements(By.tagName("tr")); // To get all Rows
int rowcount = tablerows.size(); \\To get count of total rows
for (WebElement tablerow : tablerows )
{
tablerowindex = 0;
List <WebElement> tablecolumns = tablerow.findelements(By.tagName("td"));
int columncount = tablecolumns.size();
for (WebElement tablecolumn : tablecolumns)
{
}
Those rules moreover attempted to wind up plainly a decent approach to perceive that other individuals online have the indistinguishable enthusiasm like mine to get a handle on incredible arrangement more around this condition
ReplyDeleteselenium training in bangalore|