gpt4 book ai didi

python - 如何在Selenium(python)中提取两个元素?

转载 作者:行者123 更新时间:2023-11-30 22:26:12 25 4
gpt4 key购买 nike

我需要提取“m”类和“n”类下的所有“snail”和“hello world”。m和n重复,但它们的“snail”和“hello world”不同。

[![下][1]][1] 。

最佳答案

您可以使用大部分可用的 find_element_by定位和元素的方法,这里是 list of them alongside with the docs .

例如,您可以通过链接文本查找元素,因为它们是 <a>标签:

driver.find_element_by_link_text('snail')
driver.find_element_by_link_text('Re: hello world')

或者,既然您提到了 XPath,您可以使用 .find_element_by_xpath .

关于python - 如何在Selenium(python)中提取两个元素?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47299851/

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