我想解析一些html使用Selenium。問題在於,如果類名稱包含空格,則會引發錯誤。使用Selenium解析html - 類名稱包含空格
這裏是標籤我在尋找:<p class="p0 ng-binding">text</p>
我已經試過這兩個選項:
result.find_element_by_class_name('departure').find_element_by_css_selector('p.p0 ng-binding').text
result.find_element_by_class_name('departure').find_element_by_class_name('p0 ng-binding').text
>>> selenium.common.exceptions.InvalidSelectorException: Message: The given selector p0 ng-binding is either invalid or does not result in a WebElement. The following error occurred:
InvalidSelectorError: Compound class names not permitted
任何人可以給我一個提示?
這是兩個類名。 – stark
你知道如何找到這個班嗎? –