【发布时间】:2022-01-16 00:48:13
【问题描述】:
我已尝试从该站点中删除信息 - 特别是从表格中。每次我出现,元素不存在的信息。
https://polygonscan.com/token/0x64a795562b02830ea4e43992e761c96d208fc58d
我尝试将time.slep(5) 添加到我的代码或向下滚动功能以加载所有元素 - 无效。
你对我有什么建议吗?
编辑
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
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
# Options
chrome_options = Options()
chrome_options.add_argument("--headless")
# Set drive
chrome_driver_path = r"C:\Users\kacpe\OneDrive\Pulpit\Python\Projekty\chromedriver.exe"
driver = webdriver.Chrome(chrome_driver_path, options=chrome_options)
driver.get("https://polygonscan.com/token/0x64a795562b02830ea4e43992e761c96d208fc58d")
try:
element = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.XPATH, "//table/tbody/tr[0]")))
print(element)
except TimeoutException as e:
print(e)
我根据您的请求添加了代码。所以我的主要目标是从这个站点的表格中删除内容。我将显式等待添加到我的代码中,但我仍然无法从该表中选择任何内容 - 看起来脚本没有看到该区域的任何内容。
【问题讨论】:
标签: python selenium web-scraping