Introduction to xPath

These are a couple of resources to help you get started with the extraction of Monitoring Job.

  1. Every website has a source code
  2. The source code is built in a hierarchical way. This hierarchy is called DOM and looks like a tree (https://www.google.com/search?q=DOM+hierarchy)
  3. DOM consists of HTML elements that have attributes and content (https://www.learn-html.org/en/Basic_Elements)
  4. Example:
    <div class="example_styling_class">Text displayed in the browser</div>
  5. div is an element
  6. class is an attribute
  7. “Text displayed in the browser” is the element’s content
  8. You can view a DOM for any webpage. Right-click in your browser anywhere in a page and click “inspect element”
  9. There is a special language called xPath that makes extracting structured data from DOM elements possible
  10. The easiest way to get a xPath for an element is to right-click on an element, “inspect element” and copy xPath from the console
  11. You can use this result in Midesk
    //*[@id="text"]/h1
  12. There are brittle and robust ways how to use xPath. We’ll be more than happy to support you with it
  13. Cheatsheet for xPath: https://devhints.io/xpath
© 2019 - 2023 Midesk UG (haftungsbeschränkt)