How can I find the link URL by link text with XPath?

后端 未结 6 1833
臣服心动
臣服心动 2020-12-04 08:06

I have a well formed XHTML page. I want to find the destination URL of a link when I have the text that is linked.

Example



        
6条回答
  •  隐瞒了意图╮
    2020-12-04 08:23

    Too late for you, but for anyone else with the same question...

    //a[contains(text(), 'programming')]/@href
    

    Of course, 'programming' can be any text fragment.

提交回复
热议问题