Today data can be stored in many formats. One of the type that the data that we can store is in the form of a table. This tabular data is useful for clear picturization of data over the network.  This type of data is most useful for easy information storing and retrieving of data.  We came across the many tables over this blog.  Each table varies from one another across the tools. Basically, a table is a combination of rows and columns. Today we have many tools over the network. Over this network, some features would be common in all the tools, while some would be varying. One of the most evergreen useful tools is Selenium. Ever after the decades of its arrival, its importance is not yet decreased.  It has been a long time to know the functioning of the functions. So In this article, I would like to share you How to handle dynamic data in  selenium

Get the best training  on selenium  from OnlineITGuru  through Selenium Online Training Bangalore

Today no company would work without the testing department in an IT company. Because no company can launch their project without testing.  This department has become a heart of the IT project. Today in this fast moving technology world, no company would like to do the manual testing.  Because this manual testing is a time taking process. So the people prefer to do automated testing like selenium rather than manual testing. So read the complete article to know the functioning of various commands in selenium.

Before going to know how do web table and Alert() function in selenium, let me define you those terms :

In order to create a web table, we need to  Know HTML and its tags (functioning).

 What is a Table?

A table is a kind of HTML data displayed as a conjunction of <tr> and <td> tags . Along we have many tags for creating the table, these were the essential elements to build a table. Here ,   <tr> stands  for table  row and <td >  stands for table data and defines the  table table . One more tag here we need to consider is <th>, which means table head.

What is a web table?

Web tables are the usually group of elements that are stored logically in the row and column format.  This is used to organize the similar data on the web page. This is used when there is a  bulk amount of similar data. For example, a list of members of an organization.

Types of Web tables :

Web tables were usually classified  into two types :

Static tables: A table where the number of rows was previously defined.

This suits well for some kind of data. But all the time data would not be stationary. There are cases where the data would be goes on updating  (Example: members of an organization). In that scenario, we should move to the next type of table.

Dynamic tables: In this type of data, the number of rows of data would be defined dynamically.

How to handle dynamic data in Selenium :

There is no rocket science to handle the data in selenium, In most of the times, the data that needs to fetch is in the form of text. It is a simple and easy task by selecting the number of rows and columns to fetch. And if it’s a file we can fetch using the file location. You can handle  using the following browsers .How to handle dynamic data in Selenium

For the purpose of defining the web data,  we need to define the web element.

Web element :

These are nothing but the HTML elements defined between the start and web tags. These web tags are useful for the purpose of retrieving the data.

 The following code is useful get the data of 1st columns of data in 2 nd row .

  /html/body/div[1]/div[2]/div/div[2]/article/div/table/tbody/tr[2]/td[1]

This code can also be divided as

  • Part 1– Location of the table in the webpage </html/body/div[1]/div[2]/div/div[2]/article/div/>
  • Part 2– Table body (data) starts from here <table/tbody/>
  • Part 3– It says table row 2 and table column 1 <tr[2]/td[1]>

If you want to get the specific cell of the table, we need to use  XPath.

Get Text () method is used for getting the web driver element

Hope you are clear with how to find the web element in Selenium Web driver .

Recommended Audience :

Software developers

System Admins

Project  Managers

Team Leaders

Prerequisites:

There is nothing prerequisite required for learning Selenium.It’s good to have analytical skills and knowledge of some and the basic idea of troubleshooting and some knowledge of programming languages like Java, C#,  PERL and one database like MySQL. But not mandatory.Trainers of OnlineITGuru will teach you from the basics.

Master of Selenium  testing from OnlineITGuru through Selenium Online Training

 
Drop Us A Query

100% Secure Payments. All major credit & debit cards accepted.