【发布时间】:2023-01-27 21:43:10
【问题描述】:
我正在重写这个使用旧版本 Selenium 的旧 pyton 脚本 (https://github.com/muvvasandeep/BuGL/blob/master/Scripts/DataExtraction.py)。这个脚本的目的是从 github 的开源项目中提取开放和关闭的问题。我是 python 和 Selenium 的新手。我很难重写里面的几件事。目前我正在努力让这个工作:
repo_closed_url = [link.get_attribute('href') for link in driver.find_elements(By.XPATH,'//div[@aria-label="Issues"]').find_element(By.CLASS_NAME,'h4')]
上面应该从 github 页面获取所有已关闭的问题链接并将其存储在 repo_closed_url 数组中。但我收到 AttributeError: 'list' object has no attribute 'find_element' 错误。请帮忙。
【问题讨论】:
-
发生此错误是因为您正在尝试将 .find_element 用于列表。尝试获取驱动程序的数据类型
标签: python selenium selenium-webdriver selenium-chromedriver