使用Python selenium从动态网站表格抓取数据

0 投票
0 回答
19 浏览
提问于 2025-04-12 04:57

我在用Python的selenium库从网站 https://dexscreener.com/ 抓取一些信息。其实,我只想要列表中当前最上面的那个名字(见截图)。列表的过滤和排序对我来说不重要,因为我已经单独实现了这些功能。

我使用了附带的代码结构,尝试了几种方法(比如By.XPATH、By.Name等),但就是无法打印出那个名字。我对selenium还比较陌生,使用的是Chrome的webdriver。有人能帮我解决这个问题吗?

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options

options = Options()
options.add_experimental_option("debuggerAddress", "localhost:8989")
driver = webdriver.Chrome(options=options)

driver.get("https://dexscreener.com/")

table = driver.find_element(By.XPATH,"...")
print(..)

非常感谢!!

我使用了附带的代码结构,尝试了几种方法(比如By.XPATH、By.Name等),但就是无法打印出那个名字。我对selenium还比较陌生。

0 个回答

暂无回答

撰写回答