Skip to content
Advertisement

BeautifulSoup doesn’t find tables on webpage

I’m trying to get the data from the 1st table on a website. I’ve looked on here for similar problems and tried a number of the given solutions but can’t seem to find the table and ultimately the data in the table.

I’ve tried:

JavaScript

and tried using beautiful soup

JavaScript

Any help is much appreciated.

Advertisement

Answer

Table is present inside an iframe you need to switch iframe first to access the table.

Induce WebDriverWait() and wait for frame_to_be_available_and_switch_to_it() and following locator.

Induce WebDriverWait() and wait for visibility_of_element_located() and following locator.

JavaScript

You need to import below libraries.

JavaScript

Or you use below code with xpath.

JavaScript

You can import further your table data to pandas dataframe and then export to csv file.You need to import pandas.

JavaScript

Import pandas: pip install pandas

Then add the below library

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