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: src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/textcontent--options--.md
+2-7Lines changed: 2 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,13 +33,8 @@ export default async function () {
Copy file name to clipboardExpand all lines: src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page.md
+18-26Lines changed: 18 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,29 +47,21 @@ Page provides methods to interact with a single tab in a running web browser ins
47
47
|[page.setContent(html, [options])](/javascript-api/k6-experimental/browser/page/setcontent/)| Sets the supplied html string to the current page. |
48
48
|[page.setDefaultNavigationTimeout(timeout)](/javascript-api/k6-experimental/browser/page/setdefaultnavigationtimeout/)| Changes the navigation timeout for [page.goto(url, [options])](/javascript-api/k6-experimental/browser/page/goto/), [page.reload([options])](/javascript-api/k6-experimental/browser/page/reload/), [page.setContent(html, [options])](/javascript-api/k6-experimental/browser/page/setcontent/), and [page.waitForNavigation([options])](/javascript-api/k6-experimental/browser/page/waitfornavigation/)|
49
49
|[page.setDefaultTimeout(timeout)](/javascript-api/k6-experimental/browser/page/setdefaulttimeout/)| Changes the timeout for all the methods accepting a `timeout` option. |
|[page.setExtraHTTPHeaders(headers)](/javascript-api/k6-experimental/browser/page/setextrahttpheaders/)| Sets extra HTTP headers which will be sent with subsequent HTTP requests. |
51
+
|[page.setViewportSize(viewportSize)](/javascript-api/k6-experimental/browser/page/setviewportsize/)| Updates the page's width and height. |
52
+
|[page.tap(selector, [options])](/javascript-api/k6-experimental/browser/page/tap/)| Taps the first element that matches the selector. |
53
+
|[page.textContent(selector, [options])](/javascript-api/k6-experimental/browser/page/textcontent/)| Returns the `element.textContent`. |
54
+
|[page.title()](/javascript-api/k6-experimental/browser/page/title/)| Returns the page's title. |
55
+
|[page.type(selector, text, [options])](/javascript-api/k6-experimental/browser/page/type/)| Types the `text` in the first element found that matches the selector. |
56
+
|[page.touchScreen()](/javascript-api/k6-experimental/browser/page/touchscreen/)| Returns the [Touchscreen](/javascript-api/k6-experimental/browser/touchscreen/) instance to interact with a virtual touchscreen on the page. |
57
+
|[page.uncheck(selector, [options])](/javascript-api/k6-experimental/browser/page/uncheck/)| Unselects an input checkbox. |
58
+
|[page.url()](/javascript-api/k6-experimental/browser/page/url/)| Returns the page's URL. |
59
+
|[page.viewportSize()](/javascript-api/k6-experimental/browser/page/viewportsize/)| Returns the page's size (width and height). |
60
+
|[page.waitForFunction(pageFunction, arg, [options])](/javascript-api/k6-experimental/browser/page/waitforfunction/)| Returns when the `pageFunction` returns a truthy value. |
61
+
|[page.waitForLoadState(state, [options])](/javascript-api/k6-experimental/browser/page/waitforloadstate/)| Waits for the given load state to be reached. |
62
+
|[page.waitForNavigation([options])](/javascript-api/k6-experimental/browser/page/waitfornavigation/)| Waits for the given navigation lifecycle event to occur and returns the main resource response. |
63
+
|[page.waitForSelector(selector, [options])](/javascript-api/k6-experimental/browser/page/waitforselector/)| Returns when element specified by selector satisfies `state` option. |
64
+
|[page.waitForTimeout(timeout)](/javascript-api/k6-experimental/browser/page/waitfortimeout/)| Waits for the given `timeout` in milliseconds. |
65
+
|[page.workers()](/javascript-api/k6-experimental/browser/page/workers/)| Returns an array of the dedicated WebWorkers associated with the page. |
66
+
|[page.$(selector)](/javascript-api/k6-experimental/browser/page/$/)| Finds an element matching the specified selector within the page. |
67
+
|[page.$$(selector)](/javascript-api/k6-experimental/browser/page/$$/) | Finds all elements matching the specified selector within the page. |
Use locator-based [`page.locator(selector)`](/javascript-api/k6-experimental/browser/page/locator/) instead.
9
+
10
+
</Blockquote>
11
+
12
+
The method finds an element matching the specified selector within the page. If no elements match the selector, the return value resolves to `null`. To wait for an element on the page, use [locator.waitFor([options])](/javascript-api/k6-experimental/browser/locator/waitfor/).
| selector | string |`''`| A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. |
19
+
| options | object |`null`||
20
+
| options.force | boolean |`false`| Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). |
21
+
| options.modifiers | string[]|`null`|`Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the action. If not specified, currently pressed modifiers are used. |
22
+
| options.noWaitAfter | boolean |`false`| If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. |
23
+
| options.position | object |`null`| A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. |
24
+
| options.position.x | number |`0`| The x coordinate. |
25
+
| options.position.y | number |`0`| The y coordinate. |
26
+
| options.strict | boolean|`false`| When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. |
27
+
| options.timeout | number |`30000`| Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/) or [Page](/javascript-api/k6-experimental/browser/page/). |
28
+
| options.trial | boolean |`false`| Setting this to `true` will perform the actionability checks without performing the action. |
| selector | string |`''`| A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. |
19
+
| options | object |`null`||
20
+
| options.strict | boolean|`false`| When `true`, the call requires selector to resolve to a single element. If given selector resolves to more than one element, the call throws an exception. |
21
+
| options.timeout | number |`30000`| Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/) or [Page](/javascript-api/k6-experimental/browser/page/). |
0 commit comments