遵循我从浏览器复制的xpath (检查)
# // *[ @ id = "customize-coverage--customize-your-quote--propertyDamage-1--info-title"]我正在尝试读取元素,但它无法使用下面的xpath找到它
有没有什么办法可以通过硒来定位上面的元素?请帮帮忙。我不确定为什么驱动程序不能定位web元素。
return self.page_element(By.XPATH,
'//*[starts-with(@id,"customize-coverage--customize-your-quote--propertyDamage-") and ends-with(@id,"-info-title")]/span').text我也尝试使用contains和regex。似乎什么都不起作用。
注意:我使用的是python
发布于 2020-09-09 15:37:41
ends-with()需要Selenium 2.0,尽管这已经有近14年的历史了,但Selenium还没有实现它。您必须结合使用substring()和string-length()。
https://stackoverflow.com/questions/63806657
复制相似问题