Skip to content
Advertisement

Scraping tables from a JavaScript webpage using Selenium, BeautifulSoup, and Panda

to begin with I am a beginner and trying to achieve something which is currently out of my league. However, I hope you guys can help me out. Much appreciated.

I am trying to scrape the table from spaclens.com. I already tried using the out-of-the-box solution from Google sheets however the site is Java Script based which Google sheets cannot handle. I found some code online which I altered to fit my needs however I am stuck.

JavaScript

The code above gives me the following error:

JavaScript

Do I need to alter the argument to find the table? Anyone can shed some light on this?

Thanks!!

Advertisement

Answer

Be easier to just grab the data from the source. Comes to you in a nice json format.

JavaScript

Output: 846 rows, 78 columns

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement