我正试着从一条推特上删除一些数据。
from selenium import webdriver
!pip install kora -q
from kora.selenium import wd
link = 'https://twitter.com/psalmcrypt/status/1442460419612835840?s=19'
wd.get(link)
for a in wd.find_element(By.XPATH , '//*[@id="id__armfsi35bm"]/div[2]/div/div/a'):
promoter = a.get_attribute('href')
print(promoter)我收到了以下错误-

我正在从检查器窗口复制xpath。
发布于 2022-08-05 12:56:29
for循环用于迭代序列,即list、tuple、dictionary、set或string。
在您的使用过程中,应该是list of WebElement。要返回list而不是find_element(),您需要find_elements(),如下所示:
for a in wd.find_elements(By.XPATH , 'xpath_of_the_elements'):https://stackoverflow.com/questions/73249770
复制相似问题