我的使用python,BeautifulSoup和Selenium的Webscraper返回“ []”。最初我只是使用BeautifulSoup并遇到相同的问题,由于我要抓取的是天气数据,因此我尝试使用硒。 这是代码和html代码段,对此我真的很陌生,所以在此先谢谢你:)
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from bs4 import BeautifulSoup
import time
driver = webdriver.Chrome()
driver.get("https://wx.ikitesurf.com/spot/93670")
time.sleep(5)
windspeed = driver.find_elements_by_class_name("jw-spot-list-marker")
print (windspeed)
driver.close()
html
<span class="jw-list-view-wind-desc">9 (g15) mph W</span>