Support > Forums > OpenBots Studio > How to scarp a data table from a website?

How to scarp a data table from a website?

Roman Sinkarenko

  • Reporter
  • Calender Icon June 23,2022 at 7:46 PM

Hello community, I'm new here at OpenBots and want to scrap a data table from a website. I have two options as I see … one with selenium and one with the native browser activities.

I'm still struggling to get the values from the HTML-Table. Can anyone advise me how to get the hole Table dynamically?

My example is https://www.w3schools.com/html/html_tables.asp

This forum has 314 topics, 681 replies, and was last updated 16 days ago by Support Agent

Nataly Alvarado

  • Participant
  • Calender Icon June 23,2022 at 8:17 PM

Hi roman.sinkarenko,

I would recommend to use the Native Browser commands to interact with websites. In the example that you mention, you would first need to create the browser automation instance by using the Native Browser Create Application command or the Native Browser Attach Application command.

Then, use the Native Browser Get Table command to interact with the table element. You can follow the below steps to extract the Example table in the mentioned site: https://www.w3schools.com/html/html_tables.asp:

  1. Use the Native Element Recorder and select one of the table cells. The generated selector will point to the table cell element. In order to extract the table as a whole, you will need to modify the selector to point to the Table type element. Uncheck the last parameter "Tag Name: TD" and check the "Tag Name: TABLE" as the targeted element

  2. Check the Table parameter information. You will notice that the ID, Tag Name and Inner Text fields are enabled. In this case, only the ID and Tag Name are need, as the Inner Text information contains data that could change dynamically, as well as invalid characters (\t).

  3. Validate your selector to make sure the changes are effective by clicking on UI Element Validator

  4. Indicate the output datatable variable and run the script

The table contents should be extracted into the datatable variable, which you can use across your automation.

You are not authorized to reply, please click here to login and add your reply to this topic.