> For the complete documentation index, see [llms.txt](https://docs.does.qa/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.does.qa/elements/selector-types/xpath.md).

# XPath

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](/elements/selector-types/css.md) and [Visible Text](/elements/selector-types/visible-text.md) do not cover. When your application exposes dedicated test attributes, prefer [Test ID](/elements/selector-types/test-id.md) for stability.

See [Creating Elements](/elements/creating-elements.md) 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`

## Related

* [Test ID](/elements/selector-types/test-id.md)
* [CSS](/elements/selector-types/css.md)
* [Visible Text](/elements/selector-types/visible-text.md)
* [Creating Elements](/elements/creating-elements.md)
* [Choose durable selectors](/better-coverage/choose-durable-selectors.md)
