Comments on: Selenium – Handling Web Tables, Frames, and Dynamic Elements https://www.softwaretestinghelp.com/selenium-tutorial-18/ Passion for Quality! Fri, 09 May 2025 10:49:46 +0000 hourly 1 https://wordpress.org/?v=6.9 By: raghu https://www.softwaretestinghelp.com/selenium-tutorial-18/#comment-312752 Mon, 16 Dec 2024 11:37:50 +0000 https://www.softwaretestinghelp.com/?p=4808#comment-312752 public void f() throws IOException, BiffException {
int rows = driver.findElements(By.tagName(“tr”)).size();
System.out.println(“totalrows–“+rows);
int columns = driver.findElements(By.xpath(“//*[@id=’leftcontainer’]/table/thead/tr[1]/th”)).size();
System.out.println(“totalcolumns–“+columns);
List Wvalues = new ArrayList();

for(int m=1;m<=rows;m++)
{

for(int n=1;n<=columns;n++)
{

String data = driver.findElement(By.xpath("//*[@id='leftcontainer']/table/tbody/tr["+m+"]/td["+n+"]")).getText();
System.out.println(data);
Wvalues.add(data);

how could i print the rows and columns text values in selenium. and how could i get the xlvalues from rows and columns from excel sheet.

]]>
By: saikrishna https://www.softwaretestinghelp.com/selenium-tutorial-18/#comment-281366 Tue, 19 Nov 2024 16:19:32 +0000 https://www.softwaretestinghelp.com/?p=4808#comment-281366 How to get the particular cell data?in web table
For example in a table 10 rows and 20 colms are there.I want only 9 colom and 10 row data.

]]>
By: gopi https://www.softwaretestinghelp.com/selenium-tutorial-18/#comment-263393 Sun, 17 Nov 2024 22:45:34 +0000 https://www.softwaretestinghelp.com/?p=4808#comment-263393 In dynamic webtable, data is presented number of times.Now i want to count the repeated values in table.
How can i get repeated data ??

]]>
By: Anil https://www.softwaretestinghelp.com/selenium-tutorial-18/#comment-198002 Fri, 15 Nov 2024 06:34:02 +0000 https://www.softwaretestinghelp.com/?p=4808#comment-198002 Nice one

]]>
By: satyen tiwari https://www.softwaretestinghelp.com/selenium-tutorial-18/#comment-344807 Sat, 12 Oct 2024 19:56:54 +0000 https://www.softwaretestinghelp.com/?p=4808#comment-344807 thank you for helping us …

]]>
By: Naveen https://www.softwaretestinghelp.com/selenium-tutorial-18/#comment-180288 Sat, 12 Oct 2024 01:06:12 +0000 https://www.softwaretestinghelp.com/?p=4808#comment-180288 Excellent solutions !!! Please keep posting on such new stuff in Selenium

]]>
By: Jesse Kindwall https://www.softwaretestinghelp.com/selenium-tutorial-18/#comment-494782 Fri, 04 Oct 2024 00:30:03 +0000 https://www.softwaretestinghelp.com/?p=4808#comment-494782 In reply to Monisha.

There are ways to do this simply using xpaths, but it can get kind of long and convoluted. However, if you happen to be using the .NET version of WebDriver, I’ve just released an extension called TableDriver.NET that makes working with tables and specifically finding rows by their contents much easier. You can find the project here: https://github.com/jkindwall/TableDriver.NET. Here’s a quick example of how its used:

Assuming we are working with the html table in section #1 of this article, and we want to look up how many points Eve Jackson has, with the TableDriver extension to WebDriver, the code would look like this:

Table table = Table.Create(driver.FindElement(By.Id(“main”)));
string points = table.FindCell(“Firstname=Eve&Lastname=Jackson”, “Points”).Element.Text;

]]>
By: Jesse Kindwall https://www.softwaretestinghelp.com/selenium-tutorial-18/#comment-495732 Sun, 15 Sep 2024 13:54:41 +0000 https://www.softwaretestinghelp.com/?p=4808#comment-495732 In reply to Monisha.

There is now a Java version of TableDriver available here (https://github.com/jkindwall/TableDriver.Java)

]]>
By: Surya https://www.softwaretestinghelp.com/selenium-tutorial-18/#comment-257270 Fri, 16 Aug 2024 16:55:55 +0000 https://www.softwaretestinghelp.com/?p=4808#comment-257270 @Monisha

I have find the solution to the problem you are facing
please use the two for loop to generate the xpath dynamically and it should work .It worked for me

]]>
By: priyanka https://www.softwaretestinghelp.com/selenium-tutorial-18/#comment-486207 Tue, 16 Apr 2024 02:57:51 +0000 https://www.softwaretestinghelp.com/?p=4808#comment-486207 How to get data from excel sheet that has n no of rows and sheet, how to handle this with array?

]]>
By: Chandana https://www.softwaretestinghelp.com/selenium-tutorial-18/#comment-486415 Fri, 08 Mar 2024 00:43:02 +0000 https://www.softwaretestinghelp.com/?p=4808#comment-486415 How to declare all frames in method as function which could be called in other program as generic function??
Ex:
public static void Machint_Click(String LocatorType, String LocatorValue, String WaitType) throws Exception
{
try
{
locator = locatorValue(LocatorType, LocatorValue);
element = driver.findElement(locator);
Machint_Wait(WaitType);
element.click();
Thread.sleep(2000);
}
catch (NoSuchElementException e)
{
System.err.format(LocatorType+ ” is invalid”);
}
}

]]>
By: Suriya https://www.softwaretestinghelp.com/selenium-tutorial-18/#comment-254287 Fri, 12 Jan 2024 06:52:09 +0000 https://www.softwaretestinghelp.com/?p=4808#comment-254287 Thank u for your solution

]]>
By: Kumar https://www.softwaretestinghelp.com/selenium-tutorial-18/#comment-493009 Tue, 09 Jan 2024 01:33:26 +0000 https://www.softwaretestinghelp.com/?p=4808#comment-493009 Hi,

Can anyone advice how to write the code for example there is web table with multiple rows and columns, one of column is “NAME” and other column is “CITY” and many other columns too. So to write the code to get the CITY column text value of Robert (NAME Column) in web table, and here multiple rows of info available.

]]>
By: nihal https://www.softwaretestinghelp.com/selenium-tutorial-18/#comment-140209 Sun, 12 Nov 2023 11:36:05 +0000 https://www.softwaretestinghelp.com/?p=4808#comment-140209 very nice tutorial

]]>
By: happy https://www.softwaretestinghelp.com/selenium-tutorial-18/#comment-162996 Tue, 17 Oct 2023 02:20:14 +0000 https://www.softwaretestinghelp.com/?p=4808#comment-162996 I am learning selenium, thanks for the post.
I am facing one problem.
i have one tree view control. nodes creating dynamically with context menu – insert command.
I need get that textbox and to give node value.
i have tried with given options in – Dynamic elements part but i didn’t get solution.
In mycase javascript using to insert a textbox and click on anywhere in page, box should disapper.

can you please help in this issue?

]]>
By: Shikha Nagar https://www.softwaretestinghelp.com/selenium-tutorial-18/#comment-434750 Sun, 01 Oct 2023 06:26:42 +0000 https://www.softwaretestinghelp.com/?p=4808#comment-434750 In reply to Mike.

hello,
You can use the xpath followed by /. (ex: //span[@class=’reply’]/.)
That this in List of webelements and iterate:

List element= driver.findElements(By.xpath(“//span[@class=’reply’]/.”));
For(WebElement el1: element)
{
String title=el1. .getAttribute(“title”);
system.out.println(title);
}

]]>
By: san https://www.softwaretestinghelp.com/selenium-tutorial-18/#comment-216500 Mon, 28 Aug 2023 19:18:23 +0000 https://www.softwaretestinghelp.com/?p=4808#comment-216500 How can i know a particular iframe is displayed or not on UI

]]>
By: Ak https://www.softwaretestinghelp.com/selenium-tutorial-18/#comment-289097 Sat, 10 Jun 2023 10:39:23 +0000 https://www.softwaretestinghelp.com/?p=4808#comment-289097 How to get Html table data which is not having Id, class name and having multiple tables divs using c#Selinium

]]>
By: ak https://www.softwaretestinghelp.com/selenium-tutorial-18/#comment-293489 Fri, 02 Jun 2023 07:25:25 +0000 https://www.softwaretestinghelp.com/?p=4808#comment-293489 #saikrishna
first needs to traverse the table row and traverse row’s column saved it list now you can play with list and can get the particular cell value
//find the table
Arraylist tab =table.findElements(By.tagName(“tr”));

//store the table row’s in table_row object
ArrayList table_row =(ArrayList) table.findElements(By.tagName(“tr”));
//get the row count
int rowcount=table_row.size();
System.out.println(rowcount);
//traverse the row to get column
for(int row=1;row<rowcount;row++)
{
//store the row's colmun in row_column object

ArrayList row_column =(ArrayList) table_row.get(row).findElements(By.tagName(“td”));
//get the column size
int columncount=row_column.size();
System.out.println(row+”rows column count is”+columncount);
//traverse row’s column’s
//for(int col=0;col<columncount;col++)
{
//get the cell value
String cellValue=row_column.get(col).getText();
values.add(cellValue);
System.out.println(row+"rowth"+col+"colth"+cellValue);

}
}

// if you want to reduce the table row's column
you can reduce the for loop condition statement
for(int row=1;row<rowcount;row++)
you can change the rowcount to actual need row_count

same for column
for(int col=0;col<columncount;col++)
change the columncount to actual need columncount

]]>
By: subhasri https://www.softwaretestinghelp.com/selenium-tutorial-18/#comment-294264 Fri, 26 May 2023 23:02:39 +0000 https://www.softwaretestinghelp.com/?p=4808#comment-294264 Very well explained… It’s understandable for any body… Thanks… Keep posting like this

]]>