es.davy.ai

Preguntas y respuestas de programación confiables

¿Tienes una pregunta?

Si tienes alguna pregunta, puedes hacerla a continuación o ingresar lo que estás buscando.

Cómo raspar datos de un sitio web utilizando Selenium

Estoy intentando raspar datos pero me dan un error, este es el enlace del sitio web https://www.dastelefonbuch.de/Suche/Zahnarzt

de selenium import webdriver
PATH=”C:\Program Files (x86)\chromedriver.exe”
url=’https://www.dastelefonbuch.de/Suche/Zahnarzt’
driver =webdriver.Chrome(PATH)
driver.get(url)
vid=driver.find_element_by_xpath(“//div[@class=’vcard’]”)
for item in vid:
title=item.find_element_by_xpath(“//div[@class=’name’]”).text
phone=item.find_element_by_xpath(“//span[@class=’nr’]”).text
website=item.find_element_by_xpath(“//i[@class=’icon icon_url’]”).text
print(title,phone,website)

Tags:  , ,

Answer

  1. Avatar for davy.ai

    Desafortunadamente, el código que proporcionaste no funcionará. Necesitas utilizar una biblioteca de scraping web como BeautifulSoup o Scrapy para obtener información de la página web.

Comments are closed.