【发布时间】:2021-02-27 02:37:45
【问题描述】:
【问题讨论】:
-
link = [div.p for div in soup.find_all('div', attrs={'class' : 'ctbdy'})]将为您提供p标签,您可以从那里获得span.text -
如果是材料你想做什么?
标签: python selenium loops element
【问题讨论】:
link = [div.p for div in soup.find_all('div', attrs={'class' : 'ctbdy'})] 将为您提供p 标签,您可以从那里获得span.text
标签: python selenium loops element
如果所有 span 元素具有相同的类名。获取元素跨度列表。然后使用循环逐个检查跨度文本。
list_span_elements = driver.find_elements_by_xpath("//div[@class='ctbdy']/p/span[@class='bl_name bln_end']")
for element in list_span_elements:
if (element.text == "Materials"):
print("Find element with Materials")
【讨论】: