helloworld
helloworld

Reputation: 673

Scrape a website with interactive buttons

I am totally new into scraping a website. I am trying to download the tables from https://www.ssa.gov/oact/NOTES/as120/LifeTables_Tbl_7.html

The way we use the website is to select a year from the button and press "Go", then a table for the selected year presented and I want to save the table.

I guess there should be a way to simulate human to select the year, for example, automatically select 1900 then press "go" , then loop for 100 times to record table from 1900 -2000. But I don't know how to simulate this human action.

I have know how to download the table once it is presented, but I just don't know how to let the table presented.

Thanks!

Upvotes: 1

Views: 147

Answers (1)

Tristan
Tristan

Reputation: 2088

https://www.ssa.gov/oact/NOTES/as120/LifeTables_Tbl_7_**1950**.html

https://www.ssa.gov/oact/NOTES/as120/LifeTables_Tbl_7_**2030**.html

Like you see the only thing that changes is the year. So when you go to scrape a website. you need to scrape https://www.ssa.gov/oact/NOTES/as120/LifeTables_Tbl_7_" + TheYearIWant + ".html

Upvotes: 1

Related Questions