python selenium (三) xpath定位

</span id="login">登录一下</span>
//*[@id="login"]
//*[text()="登录一下"]
//span
//span[1]
//span[-1]
//*[starts-with(text(), '登录')]
//*[contains(@id, 'ogi')]
<family>
    <parent>
        <child>Alice</child>
        <child>Bob</child>
        <child>Charlie</child>
    </parent>
</family>
//child[text()="Bob"]/preceding-sibling::child
//child[text()="Bob"]/preceding-sibling::*[1]
//child[text()="Charlie"]/preceding-sibling::*

//child[text()="Bob"]/following-sibling::child
//child[text()="Bob"]/following-sibling::*[1]
//child[text()="Alice"]/following-sibling::*

//parent/..
posted @ 2025-02-22 21:58  アーニャ  阅读(29)  评论(0)    收藏  举报