For the complete documentation index, see llms.txt. This page is also available as Markdown.

XPath

Use XPath expressions to navigate and select elements within the XML or HTML document.

XPath finds Elements by walking the DOM with a path-like syntax. It can move up the tree, match partial text, and combine several conditions in one expression.

Use XPath when you need DOM traversal or text relationships that CSS and Visible Text do not cover. When your application exposes dedicated test attributes, prefer Test ID for stability.

See Creating Elements to add a Manual Element with an XPath selector.

Examples:

  • //button[@id="submit-button"]

  • //div[contains(@class, "product-card")]

  • //ul/li[1]

  • //label[text()="Email"]/following-sibling::input

Last updated