473,508 Members | 2,140 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how can i get particular column data list in selenium?

22 New Member
Expand|Select|Wrap|Line Numbers
  1. WebElement mytable = driver.findElement(By.id("resultTable"));
  2.             //To locate rows of table. 
  3.             List < WebElement > rows_table = mytable.findElements(By.tagName("td"));
  4.             //To calculate no of rows In table.
  5.             int rows_count = rows_table.size();
  6.             String rows_count1 = rows_table.get(3).getText();
  7.             System.out.println(rows_count1);
  8.             System.out.println(rows_count);
  9.             //Loop will execute till the last row of table.
  10.             for (int row = 0; row < rows_count; row++) {
  11.                 //To locate columns(cells) of that specific row.
  12.                 List < WebElement > Columns_row1 = rows_table.get(row).findElements(By.tagName("tr"));
  13.                 //To calculate no of columns (cells). In that specific row.
  14.                 int columns_count = Columns_row1.size();
  15.                 //ListIterator<WebElement> columns_count1 = Columns_row.listIterator(1));
  16.                 System.out.println("clo----->"+columns_count);
  17.                 System.out.println("Number of cells In Row " + row + " are " + columns_count);
  18.                 //Loop will execute till the last cell of that specific row.
  19.                 for (int column = 0; column < columns_count; column++) {
  20.                     // To retrieve text from that specific cell.
  21.                     String celtext = Columns_row1.get(column).getText();
  22.                     System.out.println(celtext);
  23.                 }
  24.                 System.out.println("-------------------------------------------------- ");
  25.             }
  26.  
i trying this code but its not getting proper result.
Jun 21 '19 #1
1 4624
zmbd
5,501 Recognized Expert Moderator Expert
so... what is it that you were trying to fetch
and... what is it that you are getting

without that information it's a lot harder to help you
Jun 21 '19 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
1427
by: bissatch | last post by:
If I want to determine what data types a table has, how would I do this using PHP? I tried looking into SHOW TABLES but would I be correct in saying that just displays a list of tables? I want...
1
2883
by: Shahid Saleem | last post by:
Dear Members I am using a data list , in the item template i have used a data grid with template column (CheckBox) and a button named sumbit. I want to get the data grid selected rows(Makred...
2
4261
by: redalpha | last post by:
Hi friends, I am facing problem in finding a code which should read particular column in text file.My code opens a file split it into an array & search the string but it search that...
3
1508
by: nittin14 | last post by:
helo every1, pls solve my problem i m showing data in data list using asp.net 2003 My problem is FirstName // column name in datalist RAVI ANIL AMIT
0
1234
by: safh | last post by:
hi, i need urgently a help to retrieve data from an excel sheet(all values of a single column one by one) and need to match with all the values of a column in a table of a database(oracle). it is...
0
863
by: sherasingh | last post by:
Hello Frds. I have a Table Including Containing Credit and Debit Amount . On list Data bound i Calculated The Balance AMount. And i want that if balance amount is 0 then that particular row should...
3
1455
by: siva125 | last post by:
I use this query for my table but it retrives the value for each row. It does not retrieve the size of the column name. I need to know the number of characters occupied in particular column. How...
1
6131
by: Vinarashi | last post by:
Hi, I am trying to load a data file into database. The data should be rejected if one particular column is null. As far as i googled, there is only one way, I should make that column "not null" in...
0
1256
by: apssiva | last post by:
I need to import some particular column data from csv or excel files in my student table so that for each student ID it will update an existing field. My tools for accessing the database on the...
0
7127
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7331
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7054
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7501
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5633
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5056
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4713
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3188
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
424
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.