【发布时间】:2023-01-24 15:21:27
【问题描述】:
我想在 xpath 中获取表达式的文本,它的兄弟中只有文本 html_code
我正在尝试这种方式,但它给了我一个错误,我不知道如何选择文本,因为它没有任何标签
driver.find_element('xpath','//li[@class="icon-feature"]//i[@class="icon-stotal"]//following-sibling::text()').text
错误:
InvalidSelectorException: invalid selector: The result of the xpath expression "//li[@class="icon-feature"]//i[@class="icon-stotal"]//following-sibling::text()" is: [object Text]. It should be an element.
我只想拥有“总计 121 平方米”。
对此的任何帮助表示赞赏。
【问题讨论】:
标签: python selenium web-scraping xpath html-parsing