You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Selenium爬取IFSC网站时持续出现NoSuchElementException错误求助

爬取IFSC官网攀岩者数据遇到的Selenium定位问题

我想爬取IFSC官网上所有攀岩者的姓名、所属国家及积分数据。一开始用BeautifulSoup踩了不少坑,换成Selenium之后还是一堆问题,心态快崩了。

我翻遍了能找到的教程、官方文档还有元素定位指南,但不管用哪种定位方式,Selenium都抛出NoSuchElementException异常。我知道页面包含JavaScript,但不知道如何处理它或从中提取数据。

以下是我检查网页时看到的内容:
网页检查界面

我使用的代码如下:

from lxml import html
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException

url = "https://www.ifsc-climbing.org/index.php/world-competition/calendar?task=ranking-complete&category=3"

driver = webdriver.Firefox()
driver.get(url)

climbers = driver.find_element(By.TAG_NAME, 'tr')

内容的提问来源于stack exchange,提问作者n0ah

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.26 03:05:22