How to read Web Table values

To read web tables is something tedious task when dealing with the Selenium. There is no pre-defined class/method which will allow you to directly access the webtables. We need to create a utility or method which will pull values from webtables and allow you to do more actions on the data. To read values from web tables we will use FindElements and tagName. As we all know that return type of FindElements() is List<WebElements>, it is very powerful media to access the elements.
The logic behind accessing table elements is
  • First access the table body. Since WebTable comprises of tbody tag.
  • Access all the rows available in tbody <tr>
  • Access all the columns available for each row <td>
Please find below mentioned code to access values from any web tables.
Capture

Comments

Popular posts from this blog

API Concepts