Help Center

Topic: Tutorials


Tracking links with a text

Help Center TutorialsLast updated: 28 March, 2024

test xpath selector

You may also wish to track outgoing links that exist on the page. We suggest using "Text (all elements, sorted)" to capture links to other pages. You may use these selectors to track:

Use the following selector to track all links on a web page:

  • //a/@href

To track only external links (those not belonging to a specific website), use this selector:

  • //@href[not(contains(.,'not-this-website.com'))] Note: You should substitute 'not-this-website.com' with the website URL.

If you want to track links containing specific keywords in their URLs, use this selector as an example:

  • //a[contains(@href,'/download/oursoftware_')]/@href

To specifically track links leading to PDF documents, you can use this selector:

  • //a[contains(@href,'.pdf')]/@href
  • //a[contains(text(),'Download')]/@href Note: This selector is case-sensitive. e.g. if the text actually is "download", it will not be found

If you want to track links with specific CSS classes, use this selector:

  • //a[contains(@class,'your-class-name')]/@href Note: You should substitute 'your-class-name' with the class.

To track links with specific attributes (other than href), use this selector and replace "attribute-name" with the name of the attribute you're interested in:

  • //a[@attribute-name='attribute-value']/@href Note: You should substitute 'attribute-name' and 'attribute-value' with the relevant attribute values.

Get Started with PageCrawl.io Software

Track a New Page