Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

docs: Added the parent locator (..) (#16245)

Julian Verdurmen5fc1a0beca46
diff --git a/docs/src/selectors.md b/docs/src/selectors.md
index 508b54f2af..e378faa657 100644
--- a/docs/src/selectors.md
+++ b/docs/src/selectors.md
@@ -1148,6 +1148,32 @@ It is usually possible to distinguish elements by some attribute or text content
prefer using [text] or [css] selectors over the `:nth-match()`.
:::
+## Parent selector
+
+The parent could be selected with `..`, which is a short form for `xpath=..`.
+
+For example:
+
+```js
+const parentLocator = elementLocator.locator('..');
+```
+
+```java
+Locator parentLocator = elementLocator.locator("..");
+```
+
+```python async
+parent_locator = element_locator.locator('..')
+```
+
+```python sync
+parent_locator = element_locator.locator('..')
+```
+
+```csharp
+var parentLocator = elementLocator.Locator("..");
+```
+
## Chaining selectors
Selectors defined as `engine=body` or in short-form can be combined with the `>>` token, e.g. `selector1 >> selector2 >> selectors3`. When selectors are chained, the next one is queried relative to the previous one's result.