Extracting data from website as a datatable

here i am stuck with datatable,
as its shown in website its in table format and i want pre-close,DAY RANGE,year range etc in columns not in rows but its extracting with both as rows data how can i make them as columns of datatable and in right as rows data below them respectively.

and another problem is in choosing dynamic sensex names they are changing and making it as failed selector issue ,how can i fix them,plz help.

Firstly, appreciate the details you mentioned that makes members clearly understand the problem statement and help easily and quickly.

The approach you are taking is correct. Just few steps to take care.

  1. First simply extract the initial datatable that has name of the stocks
  2. As you need to fetch the information after clicking on every row element, you need to use a for each datatable loop, every loop(every row under execution) will have a stock name that can be accessed using loop variable and column name Eg. : row(“stockname”). Put that in a variable
  3. In the loop you need to xli kon the stock name, that selector needs to be dynamic. Open in UI explorer and make the stock name as a valid argument, validate the selector hy having the components that will be common ( column name, table name, etc)
  4. Then put the variable youb created in step 2 in the place of stockname in selector.
    If you variable is strStockName
    Then value of that selector will be something like
    aaname =‘{{strStockName}}’
    This will make sure every element is clicked even though they change in each execution

Store the values extracted in every loop

This way you can have the execution done for the entire list.

Also, if it is related to stocks. You can use few other websites that can give you all information easily without much complexity

1 Like

Hi @ankur_kaushik2,

Since you are dealing with financial data here, why not change tactics and use APIs. Yahoo finance does allow you to poll their APIs so do other providers. By using APIs, you will avoid a lot of UI automation and get to work with structured JSON data, which is much more reliable.

If this is a personal learning project, ignore this suggestion.

yes its assesment from my company i am working in.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.