【发布时间】:2020-08-15 03:26:53
【问题描述】:
试图获取 div 类的 XPath 和 div 内的文本。这两个 div 是:
<div class="product-card__subtitle">Women's Shoe</div>
<div class="product-card__subtitle">Men's Shoe</div>
出现硒错误的 Xpath 是:
driver.find_element_by_xpath("//div[contains(@class, 'product-card__subtitle') and text("
")='Women's Shoe']")
driver.find_element_by_xpath("//div[contains(@class, 'product-card__subtitle') and text()='Men's "
"Shoe']")
【问题讨论】:
标签: python selenium selenium-webdriver xpath xpath-1.0