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

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

Asked on January 5, 2019 in XML.
Add Comment


  • 3 Answer(s)

         To find the link url by link text with Xpath, follow the given code,

    //a[text()='text_i_want_to_find']/@href
    
    Answered on January 5, 2019.
    Add Comment

         This could an alternative code for finding the link url by the link text with path. Definitely the ‘programming’ can be any text fragment.

    //a[contains(text(), 'programming')]/@href
    
    Answered on January 5, 2019.
    Add Comment

         The below code will normally identifies an anchor node <a> which has the text that we need, and extracts the href attribute.

    //a[text()='programming quesions site']/@href
    
    Answered on January 5, 2019.
    Add Comment


  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.