使用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
相关产品推荐
相关产品推荐

