Make Selenium Easy

Get Data From Non-Table HTML Tag WebTable Using Selenium WebDriver

We have seen multiple posts on handling a web table in Selenium WebDriver. You can find them below:-

Storing Web Table Data Into List Of Map – Java

Storing Web Table Data Into A List Of Maps Using Java Stream APIs

Storing Web Table With Pagination Data Into List Of Map – Java

All above examples include a table created using table, thead, tbody, tr and td HTML tags. Many asked that in real-time we get non table tag web table also so provide an example of that as well.

Yeah, It’s true it is not mandatory to create a web table with table HTML tag only. It can be created using other tags as well. But the major part is that the handling mechanism is not different than the table tag. Just you need to play with locators.

I have taken a web table example developed using angular. I have performed below actions on this web table:-

  1. Get all headers and print.
  2. Get all rows excluding headers and print data of each column of a row with header name.

Selenium WebDriver Code

Output

You can download/clone the above sample project from here.

If you have any doubt, feel free to comment below.
If you like my posts, please like, comment, share and subscribe.
#ThanksForReading
#HappyLearning

Find all Selenium related posts here, all API manual and automation related posts here, and find frequently asked Java Programs here.

Many other topics you can navigate through the menu.

Author: Amod Mahajan

A software Tester who is paid to judge products developed by others. Currently getting paid in American Dollars. Writing technical posts and creating YouTube videos are my hobbies.

Leave a Reply

Please wait...

Subscribe to new posts to become automation expert

Want to be notified when my new post is published? Get my posts in your inbox.