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

后端 未结 6 1841
臣服心动
臣服心动 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:15

    Think of the phrase in the square brackets as a WHERE clause in SQL.

    So this query says, "select the "href" attribute (@) of an "a" tag that appears anywhere (//), but only where (the bracketed phrase) the textual contents of the "a" tag is equal to 'programming questions site'".

提交回复
热议问题