0

I'm trying to do some webscraping but it keeps showing no tables found but there is literally a table on the website. Maybe I'm not writing the right code. Someone help. Here is the link to the website. Film-Locations-in-San-Francisco

error image enter image description here

2
  • Welcome to SO! What is the code you have tried so far? It would help your question if you researched how to properly format it. Also, there are plenty of posts out there already about scraping HTML tables in Python. Commented Aug 21, 2022 at 2:45
  • Please provide enough code so others can better understand or reproduce the problem. Commented Aug 21, 2022 at 2:58

1 Answer 1

1

I guess you are using requests. But you should note that the requests does not receive the table because the table is generated after rendering the page and it is not exists in the requests data. A basic way is to use something like Selenium to first load the page then retrieve the information.

Based on your comment use something similar to:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By

driver = webdriver.Chrome(executable_path=r"C:/Users/user/Desktop/chromedriver_win32/chromedriver.exe")
driver.get("https://data.sfgov.org/Culture-and-Recreation/Film-Locations-in-San-Francisco/yitu-d5am/data")
elem = driver.find_element_by_xpath('//*[@id="renderTypeContainer"]/div[4]/div[2]/div/div[4]/div[1]/div/table')
elem.text
#driver.close()
Sign up to request clarification or add additional context in comments.

3 Comments

This is the code I used i.sstatic.net/5MY75.png
This does not work? I will try to develop a version with selenium.
Look at the answer again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.