我正在尝试查找页面上所有尚未单击或“favorited”的元素
以下是所喜爱元素的html:
<a class="button-fave unfavorited-button favorited-button" rel="78853399" alt="Add to favorites">
<div class="button-spinner"></div>
<span class="status-text">Favorite</span>
</a>
以下是不喜欢元素时的html代码:
<a class="button-fave unfavorited-button" rel="78853399" alt="Add to favorites">
<div class="button-spinner"></div>
<span class="status-text">Favorite</span>
</a>
我试过:
driver.find_element_by_class_name('button-fave unfavorited-button')
但我得到了以下信息:
The given selector button-fave unfavorited-button is either invalid or does not result in a WebElement. The following error occurred: InvalidSelectorError: Compound class names not permitted
以下是有效的,但它不能区分有利因素和不利因素:
driver.find_element_by_class_name('button-fave')
您可以找到所有
a
元素not havingfavorited-button
类:相关问题 更多 >
编程相关推荐