2024-10-01 07:45:07 发布
网友
我能做到
search = "View List" driver.find_elements_by_xpath("//*/text()[normalize-space(.)='%s']/parent::*" % search)
但我需要它忽略并匹配所有的元素,比如:“viewlist”或“viewlist”
以上这些似乎行不通。lower-case()在XPATH 1.0中
lower-case()
只有XPath 2.0支持lower-case()函数。对于XPath1.0,必须使用translate()。在
translate()
示例代码在stackoverflow answer中给出。在
编辑: selenium python绑定站点有一个常见问题解答-Does Selenium 2 supports XPath 2.0 ?:
Ref: http://seleniumhq.org/docs/03_webdriver.html#how-xpath-works-in-webdriverSelenium delegate XPath queries down to the browser’s own XPath engine, so Selenium support XPath supports whatever the browser supports. In browsers which don’t have native XPath engines (IE 6,7,8), Selenium support XPath 1.0 only.
Ref: http://seleniumhq.org/docs/03_webdriver.html#how-xpath-works-in-webdriver
Selenium delegate XPath queries down to the browser’s own XPath engine, so Selenium support XPath supports whatever the browser supports. In browsers which don’t have native XPath engines (IE 6,7,8), Selenium support XPath 1.0 only.
只有XPath 2.0支持
lower-case()
函数。对于XPath1.0,必须使用translate()
。在示例代码在stackoverflow answer中给出。在
编辑: selenium python绑定站点有一个常见问题解答-Does Selenium 2 supports XPath 2.0 ?:
相关问题 更多 >
编程相关推荐