Skip to content

Commit 632ac7d

Browse files
authored
Merge pull request #532 from drpayyne/patch-1
Added clarity in selector paths
2 parents 2805f11 + 96b7249 commit 632ac7d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

docs/guides/selectors.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,14 +208,16 @@ Here is an example of what NOT to do, but this demonstrates how the selector wor
208208
209209
In the BAD example above, we are specifying a very precise path to an input element in the DOM, starting from the very top of the document.
210210
211-
Similarly, the relative XPath selector is a double forward slash `//`. It is used to start searching for an element anywhere in the DOM.
211+
Similarly, the relative XPath selector is a double forward slash `//`. It is used to start searching for an element anywhere in the DOM starting from the specified element. If no element is defined, the entire DOM is searched.
212212
213213
Example:
214214
215215
```xpath
216216
//div[@class=’form-group’]//input[@id='user-message']
217217
```
218218
219+
In the `GOOD` example above, all `<div class='form-group'/>` elements in the DOM are matched first. Then all `<input id='user-message'/>` with `<div class='form-group'/>` as one of its parents are matched. The parent does not have to immediately precede it since it uses another double forward slash `//`.
220+
219221
#### Parent Selectors
220222
221223
The parent selector (`..`) allows you to jump to the parent element.

0 commit comments

Comments
 (0)