python - 为什么我的 webscraper 返回 [] 到 powershell?
问题描述
我使用 python、BeautifulSoup 和 Selenium 的网络爬虫返回 "[]" 。最初我只是使用 BeautifulSoup 并且遇到了同样的问题,因为我试图抓取的是天气数据,所以我尝试使用 selenium。这是代码和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>
解决方案
推荐阅读
- ms-access - 有没有办法组合具有不同长度的列的表?
- sparql - 通过端点的 Fuseki 2 事务
- reactjs - React 和 TypeScript,如何正确定义我的组件类的直接属性?
- java - 如何同时响应式地写入和读取文件
- python - 在多个虚拟环境中运行单个 IPython 内核
- postgresql - 在postgis中按中心点、半径、内角和方位角绘制扇区
- plc - 比较 2 个字符数组并在 S7 1500 (PLC) 上找到匹配项
- google-chrome - chrome webstore - 超过3个月的扩展统计
- php - WooCommerce:ACF 价值没有通过产品类别拉动
- java - Liberty Core:未找到 Spring Boot 上下文根