gpt4 book ai didi

python - 如何抓取这个字段?

转载 作者:行者123 更新时间:2023-12-04 07:43:33 24 4
gpt4 key购买 nike

我的代码转到网页并抓取所有作者,但我也需要 session 名称。
我当前的代码将只打印“SESSION”而不是 session 的值

from selenium.webdriver.common.by import By
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
driver = webdriver.Chrome()
wait=WebDriverWait(driver, 70)

driver.get('https://meetinglibrary.asco.org/results?filters=JTVCJTdCJTIyZmllbGQlMjIlM0ElMjJmY3RNZWV0aW5nTmFtZSUyMiUyQyUyMnZhbHVlJTIyJTNBJTIyQVNDTyUyMEFubnVhbCUyME1lZXRpbmclMjIlMkMlMjJxdWVyeVZhbHVlJTIyJTNBJTIyQVNDTyUyMEFubnVhbCUyME1lZXRpbmclMjIlMkMlMjJjaGlsZHJlbiUyMiUzQSU1QiU1RCUyQyUyMmluZGV4JTIyJTNBMCUyQyUyMm5lc3RlZFBhdGglMjIlM0ElMjIwJTIyJTdEJTJDJTdCJTIyZmllbGQlMjIlM0ElMjJZZWFyJTIyJTJDJTIydmFsdWUlMjIlM0ElMjIyMDIxJTIyJTJDJTIycXVlcnlWYWx1ZSUyMiUzQSUyMjIwMjElMjIlMkMlMjJjaGlsZHJlbiUyMiUzQSU1QiU1RCUyQyUyMmluZGV4JTIyJTNBMSUyQyUyMm5lc3RlZFBhdGglMjIlM0ElMjIxJTIyJTdEJTVE')


productList=wait.until(EC.presence_of_all_elements_located((By.XPATH,"//div[@class='record']")))
for product in productList:
author=product.find_element_by_xpath(".//div[@class='record__ellipsis']").text
session=product.find_element_by_xpath("//div[@class='record__meta__title']").text
print(session)

最佳答案

要获取 session 名称,请使用 xpath :

//div[@class='record__meta ng-star-inserted'][1]/div[2]
要获取 session header ,我会使用:
//div[@class='record__category ng-star-inserted']
和标题:
//div[@class='record__title ng-star-inserted']/span

关于python - 如何抓取这个字段?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67322530/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com