From 5fc1a0beca46ce67839daad7ce44b161f418932f Mon Sep 17 00:00:00 2001 From: Julian Verdurmen <5808377+304NotModified@users.noreply.github.com> Date: Mon, 8 Aug 2022 18:09:45 +0200 Subject: [PATCH] docs: Added the parent locator (..) (#16245) --- docs/src/selectors.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) 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.