You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/sources/k6/next/javascript-api/k6-browser/locator/_index.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,12 +12,13 @@ The Locator API makes it easier to work with dynamically changing elements. Some
12
12
- Helps with writing robust tests by finding an element even if the underlying frame navigates.
13
13
- Makes it easier to work with dynamic web pages and SPAs built with Svelte, React, Vue, etc.
14
14
- Enables the use of test abstractions like the Page Object Model (POM) pattern to simplify and organize tests.
15
-
-`strict` mode is enabled for all `locator` methods, which means that if more than one element matches the given selector it will throw an error.
15
+
-`strict` mode is enabled for all `locator` methods that are expected to target a single DOM element, meaning that if more than one element matches the given selector, an error will be thrown.
16
16
17
17
Locator can be created with the [page.locator(selector[, options])](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/page/locator) method.
|[all()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/locator/all)| When multiple elements match the selector, returns an array of `locator`. |
|[clear([options])](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/locator/clear)| Clears text boxes and input fields of any existing values. |
23
24
|[click([options])](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/locator/click) {{< docs/bwipt id="471" >}} | Mouse click on the chosen element. |
When multiple elements match the selector, returns an array of [Locator](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/locator/), each pointing to their respective element.
0 commit comments