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

My name is Amod Mahajan and I am an IT employee with 6+ years of experience in Software testing and staying in Bengaluru. My area of interest is Automation testing. I started from basics and went through so many selenium tutorials. Thanks to Mukesh Otwani as his tutorials are easy and cover basics to advance. I have habit of exploring concepts by deep diving. I used to make notes. I thought of sharing my knowledge through posts and now I am here. #KeepLearning #ShareLearning

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.

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

by Amod Mahajan time to read: 2 min
0
%d bloggers like this: