2024-04-25 13:02:33 发布
网友
我的目标是提取元素'$37.91'。在
但是,由于它的类(突出显示的黄色)在其他地方重复,所以我不能每次都获得这个特定的元素。(有时我会得到其他值)
如何通过类似于://div id='snsPrice'&span class='a-size-large a-color-price'之类的内容获取元素。以确保精度。在
试试这个xpath 串成本=驱动程序.findElement(按.xpath(//span[包含(@class,'total-price-value')]).getText()
以下应该行得通
driver.find_element_by_css_selector('#snsPrice > .snsPriceBlock > .a-color-price') driver.find_element_by_xpath('//*[@id="snsPrice"]/div/span[@class="a-size-large a-color-price"]')
试试这个xpath 串成本=驱动程序.findElement(按.xpath(//span[包含(@class,'total-price-value')]).getText()
以下应该行得通
相关问题 更多 >
编程相关推荐