Warum findet Selen keine Elemente?

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Warum findet Selen keine Elemente?

by Anonymous » 01 Feb 2025, 09:10

Ich möchte die Adresse der Häuser von der Website kratzen, aber der Code gibt keine Ausgabe zurück. Kann mir jemand sagen, woher das Problem stammt? < /p>
Hier ist mein Code: < /p>

Code: Select all

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

url= "https://www.zoopla.co.uk/house-prices/england/?new_homes=include&q=england+&orig_q=united+kingdom&view_type=list&pn=1"
driver=webdriver.Chrome()
driver.get(url)
# Find elements using By.CLASS_NAME
houses = driver.find_elements(By.CLASS_NAME, "w6xkpv1 w6xkpv4")

for house in houses:
# Find address within each house element
address = house.find_element(By.XPATH, './/*[@id="main-content"]/div[2]/div/div/section/div[1]/div[2]/div[1]/div/div/div/div[1]/a/h2').text
print(address)

Top