I am currently working on extracting data from a website using CasperJs. The information I need is stored in a table, and my goal is to generate a valid JSON file after scraping the site. The JSON file should include the company name, email address, website URL, and a brief description of the company's activities.
So far, I have managed to navigate to the webpage and extract some data, but I'm facing an issue where the email and website information are combined in one field. After doing some research, I learned how to select specific elements for extraction. However, I'm only able to retrieve the details from the first row of the table.
If anyone could provide guidance on how to iterate through all the rows or help me create a loop in this scenario, it would be greatly appreciated. Please keep in mind that I am not a professional developer; I am learning as I go.
Below is a snippet of my code:
insert code here...
Currently, the JSON output repeats the information from the first row because there is no loop involved. To capture data from every row, you can replace:
old code here...
with
new code here...
However, using this new code will result in capturing all the information from each row without targeting specific elements like H3 tags or links.
I can loop through the rows to extract information, but the results are messy
I can only retrieve details from the first row, but the presentation is clean
Thank you in advance for any assistance provided!