擅长:python、mysql、java
<p>您可以使用<code>find_elements_by_class_name()</code>查询文档中特定类的所有元素。你会得到一个匹配元素的列表。如果你知道它的索引,你就可以选择正确的一个,或者如果有其他的特征决定哪个是“正确的”,你就可以在它们上面迭代寻找你需要的那个</p>
<p>当然,如果你知道你想要第一个,你只需要使用<code>find_element_by_class_name()</code>,它只得到第一个。你知道吗</p>
<p>详见<a href="http://selenium-python.readthedocs.io/locating-elements.html" rel="nofollow noreferrer">the documentation</a>。你知道吗</p>