OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Cannot locate cell content using Selenium and BeautifulSoup

  • Thread starter Thread starter Kris C
  • Start date Start date
K

Kris C

Guest
New to web scraping and selenium/beautifulsoup in general. I've been trying to scrape data from this website but beautifulsoup can't seem to find the text that I want. I just want the date of the first incident that shows up so I used inspect element to find the text is in a vaadin-grid-cell-content tag with slot="vaadin-grid-cell-content-10"

I tried commands like driver.find_element using xpath and .find with beautifulsoup but can't seem to find the element. I'm currently using a driver to access the website.

Code:
driver.get("https://data.ntsb.gov/carol-main-public/query-builder?month=6&year=2024")

soup = BeautifulSoup(driver.page_source, 'html.parser')

element = soup.find('vaadin-grid-cell-content', {'slot': 'vaadin-grid-cell-content-10'})
date_text = element.text.strip()
print(date_text)

driver.quit()
<p>New to web scraping and selenium/beautifulsoup in general. I've been trying to scrape data from this <a href="https://data.ntsb.gov/carol-main-public/query-builder?month=6&year=2024" rel="nofollow noreferrer">website</a> but beautifulsoup can't seem to find the text that I want. I just want the date of the first incident that shows up so I used inspect element to find the text is in a vaadin-grid-cell-content tag with slot="vaadin-grid-cell-content-10"</p>
<p>I tried commands like driver.find_element using xpath and .find with beautifulsoup but can't seem to find the element. I'm currently using a driver to access the website.</p>
<pre><code>driver.get("https://data.ntsb.gov/carol-main-public/query-builder?month=6&year=2024")

soup = BeautifulSoup(driver.page_source, 'html.parser')

element = soup.find('vaadin-grid-cell-content', {'slot': 'vaadin-grid-cell-content-10'})
date_text = element.text.strip()
print(date_text)

driver.quit()
</code></pre>
 

Latest posts

Top