Skip to content

Commit 1494090

Browse files
inancgumusschalksnyman
authored andcommitted
Async frame.textContent
1 parent 7a188e7 commit 1494090

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
title: 'textContent(selector[, options])'
3+
description: 'Browser module: locator.textContent(selector[, options]) method'
4+
---
5+
6+
# textContent(selector[, options])
7+
8+
{{% admonition type="warning" %}}
9+
10+
Use locator-based [`locator.textContent([options])`](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/locator/textcontent/) instead.
11+
12+
{{% /admonition %}}
13+
14+
Returns the `element.textContent`.
15+
16+
<TableWithNestedRows>
17+
18+
| Parameter | Type | Default | Description |
19+
| --------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
20+
| selector | string | `''` | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. |
21+
| options | object | `null` | |
22+
| 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. |
23+
| options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/browsercontext/) or [Page](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/page/). |
24+
25+
</TableWithNestedRows>
26+
27+
### Returns
28+
29+
| Type | Description |
30+
| ------------------------- | ------------------------------------------------------------------------ |
31+
| `Promise<string \| null>` | A Promise that fulfills with the text content of the selector or `null`. |

0 commit comments

Comments
 (0)