如何过滤具有相同类的元素?
How can I filter elements that have the same class?
<html>
<body>
<p class="content">Link1.</p>
</body>
</html>
<html>
<body>
<p class="content">Link2.</p>
</body>
</html>
你可以尝试使用 find_elements_by_class_name:
You can try to get the list of all elements with class = "content"
by using find_elements_by_class_name:
a = driver.find_elements_by_class_name("content")
然后您可以点击您要查找的链接.
Then you can click on the link that you are looking for.
这篇关于Selenium在python中按类名查找元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!