Skip to content

Commit f2ec170

Browse files
committed
Add docs for frame.isHidden
1 parent ba0b038 commit f2ec170

File tree

2 files changed

+63
-1
lines changed

2 files changed

+63
-1
lines changed

docs/sources/next/javascript-api/k6-experimental/browser/frame/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ weight: 05
3636
| <a href="https://playwright.dev/docs/api/class-frame#frame-is-disabled" target="_blank" >frame.isDisabled(selector[, options])</a> | - |
3737
| <a href="https://playwright.dev/docs/api/class-frame#frame-is-editable" target="_blank" >frame.isEditable(selector[, options])</a> | - |
3838
| <a href="https://playwright.dev/docs/api/class-frame#frame-is-enabled" target="_blank" >frame.isEnabled(selector[, options])</a> | - |
39-
| <a href="https://playwright.dev/docs/api/class-frame#frame-is-hidden" target="_blank" >frame.isHidden(selector[, options])</a> | - |
39+
| [frame.isHidden(selector[, options])](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/browser/frame/ishidden/) | Checks if the matched element is `hidden`. |
4040
| [frame.isVisible(selector[, options])](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/browser/frame/isvisible/) | Checks if the matched element is `visible`. |
4141
| <a href="https://playwright.dev/docs/api/class-frame#frame-locator" target="_blank" >frame.locator(selector[, options])</a> | - |
4242
| <a href="https://playwright.dev/docs/api/class-frame#frame-name" target="_blank" >frame.name()</a> | - |
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
title: 'isHidden(selector[, options])'
3+
excerpt: 'Browser module: frame.isHidden(selector[, options]) method'
4+
---
5+
6+
# isHidden(selector[, options])
7+
8+
{{% admonition type="warning" %}}
9+
10+
Use locator-based [`locator.isHidden([options])`](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/browser/locator/ishidden/) instead.
11+
12+
{{% /admonition %}}
13+
14+
Checks if the element is `hidden`.
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+
24+
</TableWithNestedRows>
25+
26+
### Returns
27+
28+
| Type | Description |
29+
| ---- | ------------------------------------------------ |
30+
| bool | `true` if the element is `hidden`, else `false`. |
31+
32+
### Example
33+
34+
{{< code >}}
35+
36+
```javascript
37+
import { browser } from 'k6/experimental/browser';
38+
39+
export const options = {
40+
scenarios: {
41+
browser: {
42+
executor: 'shared-iterations',
43+
options: {
44+
browser: {
45+
type: 'chromium',
46+
},
47+
},
48+
},
49+
},
50+
};
51+
52+
export default async function () {
53+
const page = browser.newPage();
54+
55+
await page.goto('https://test.k6.io/browser.php');
56+
if (page.isHidden('#input-text-hidden')) {
57+
console.log('element is hidden');
58+
}
59+
}
60+
```
61+
62+
{{< /code >}}

0 commit comments

Comments
 (0)