Bry*_*res 4 python selenium selenium-webdriver
我希望能够找到包含以下内容的链接:hello,Hello,hEllo,heLlo等.到目前为止,我使用的find_elements_by_partial_link_text是casse敏感:
links = driver.find_elements_by_partial_link_text('hello')
Run Code Online (Sandbox Code Playgroud)
find_elements_by_partial_link_text()并且find_elements_by_link_text()都是区分大小写的,并且行为不容易改变.
相反,通过xpath和apply lower-case()函数查找链接:
links = driver.find_elements_by_xpath('//a[contains(lower-case(.), "hello")]')
Run Code Online (Sandbox Code Playgroud)
另见:
| 归档时间: |
|
| 查看次数: |
1572 次 |
| 最近记录: |