Skip to content

Commit 9c334bd

Browse files
committed
docs: initial commit for page api documentation
1 parent ae65ec5 commit 9c334bd

29 files changed

+1144
-108
lines changed

src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/01 Browser class/newcontext--options--.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Creates and returns a new [BrowserContext](/javascript-api/k6-experimental/brows
2828
| options.locale | string | system | Specifies the user's locale, such as `'en-US'`, `'tr-TR'`, etc. |
2929
| options.offline | boolean | `false` | Whether to emulate an offline network. |
3030
| options.permissions | Array | `null` | Permissions to grant for the context's pages. See [browserContext.grantPermissions()](/javascript-api/k6-experimental/browser/browsercontext/#browsercontext-grantpermissions-permissions-options) for the options. |
31-
| options.reducedMotion | string | `'no-preference'` | Minimizes the amount of motion by emulating the 'prefers-reduced-motion' media feature. It can be one of `'reduce'` and `'no-preference'`. See [page.emulateMedia()](/javascript-api/k6-experimental/browser/page/#page-emulatemedia-options) for the options. |
31+
| options.reducedMotion | string | `'no-preference'` | Minimizes the amount of motion by emulating the 'prefers-reduced-motion' media feature. It can be one of `'reduce'` and `'no-preference'`. See [page.emulateMedia()](/javascript-api/k6-experimental/browser/page/emulatemedia) for the options. |
3232
| options.screen | object | `{'width': 1280, 'height': 720}` | Sets a window screen size for all pages in the context. It can only be used when the viewport is set. |
3333
| options.screen.width | number | `1280` | Page width in pixels. |
3434
| options.screen.height | number | `720` | Page height in pixels. |

src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/01 Browser class/newpage--options--.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Creates a new [Page](/javascript-api/k6-experimental/browser/page/) in a new [Br
2828
| options.locale | string | system | Specifies the user's locale, such as `'en-US'`, `'tr-TR'`, etc. |
2929
| options.offline | boolean | `false` | Whether to emulate an offline network. |
3030
| options.permissions | Array | `null` | Permissions to grant for the context's pages. See [browserContext.grantPermissions()](/javascript-api/k6-experimental/browser/browsercontext/#browsercontext-grantpermissions-permissions-options) for the options. |
31-
| options.reducedMotion | string | `'no-preference'` | Minimizes the amount of motion by emulating the 'prefers-reduced-motion' media feature. It can be one of `'reduce'` and `'no-preference'`. See [page.emulateMedia()](/javascript-api/k6-experimental/browser/page/#page-emulatemedia-options) for the options. |
31+
| options.reducedMotion | string | `'no-preference'` | Minimizes the amount of motion by emulating the 'prefers-reduced-motion' media feature. It can be one of `'reduce'` and `'no-preference'`. See [page.emulateMedia()](/javascript-api/k6-experimental/browser/page/emulatemedia) for the options. |
3232
| options.screen | object | `{'width': 1280, 'height': 720}` | Sets a window screen size for all pages in the context. It can only be used when the viewport is set. |
3333
| options.screen.width | number | `1280` | Page width in pixels. |
3434
| options.screen.height | number | `720` | Page height in pixels. |
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
title: "Page"
3+
excerpt: "Browser module: Page Class"
4+
---
5+
6+
Page provides methods to interact with a single tab in a running web browser instance. One instance of the browser can have many page instances.
7+
8+
| Method | Description |
9+
|---------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------|
10+
| [page.bringToFront()](/javascript-api/k6-experimental/browser/page/bringtofront/) | Activates a browser tab. |
11+
| [page.check(selector, [options])](/javascript-api/k6-experimental/browser/page/check/) | Select the input checkbox. |
12+
| [page.click(selector, [options])](/javascript-api/k6-experimental/browser/page/click/) | Clicks an element matching a `selector`. |
13+
| [page.close()](/javascript-api/k6-experimental/browser/page/close/) | Closes a tab that a page is associated with. |
14+
| [page.content()](/javascript-api/k6-experimental/browser/page/content/) | Gets the HTML contents of the page. |
15+
| [page.context()](/javascript-api/k6-experimental/browser/page/context/) | Gets the [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/) that the page belongs to. |
16+
| [page.dblclick(selector, [options])](/javascript-api/k6-experimental/browser/page/dblclick/) | Mouse double clicks an element matching provided selector. |
17+
| [page.dispatchEvent(selector, type, eventInit, [options])](/javascript-api/k6-experimental/browser/page/dispatchevent/) | Dispatches HTML DOM event types e.g. `'click'` |
18+
| [page.emulateMedia([options])](/javascript-api/k6-experimental/browser/page/emulatemedia/) | Changes the CSS media type and the color scheme feature. |
19+
| [page.emulateVisionDeficiency(type)](/javascript-api/k6-experimental/browser/page/emulatevisiondeficiency/) | Emulates your website with the specified vision deficiency type. |
20+
| [page.evaluate(pageFunction, arg)](/javascript-api/k6-experimental/browser/page/evaluate/) | Returns the value of the pageFunction invocation. |
21+
| [page.evaluateHandle(pageFunction, arg)](/javascript-api/k6-experimental/browser/page/evaluate/) | Returns the value of the pageFunction invocation as a [JSHandle](javascript-api/k6-experimental/browser/jshandle/). |
22+
| [page.fill(selector, value, [options])](/javascript-api/k6-experimental/browser/page/fill/) | Fill an `input`, `textarea` or `contenteditable` element with the provided value. |
23+
| [page.focus(selector, [options])](/javascript-api/k6-experimental/browser/page/focus/) | Fetches an element with `selector` and focuses it. |
24+
| [page.frames()](/javascript-api/k6-experimental/browser/page/frames/) | Returns an array of frames on the page. |
25+
| [page.getAttribute(selector, name, [options])](/javascript-api/k6-experimental/browser/page/getattribute/) | Returns the element attribute value for the given attribute name. |
26+
| [page.goto(url, [options])](/javascript-api/k6-experimental/browser/page/goto/) | Navigates to the specified url. |
27+
| [page.hover(selector, [options])](/javascript-api/k6-experimental/browser/page/hover/) | Hovers over an element matching `selector`. |
28+
| [page.innerHTML(selector, [options])](/javascript-api/k6-experimental/browser/page/innerhtml/) | Returns the `element.innerHTML`. |
29+
| [page.innerText(selector, [options])](/javascript-api/k6-experimental/browser/page/innertext/) | Returns the `element.innerText`. |
30+
| [page.inputValue(selector, [options])](/javascript-api/k6-experimental/browser/page/inputvalue/) | Returns `input.value` for the selected `input`, `textarea` or `select` element. |
31+
| [page.isChecked(selector, [options])](/javascript-api/k6-experimental/browser/page/ischecked/) | Checks to see if the `checkbox` `input` type is selected or not. |
32+
| [page.isClosed()](/javascript-api/k6-experimental/browser/page/isclosed/) | Checks if the page has been closed. |
33+
| [page.isDisabled(selector, [options])](/javascript-api/k6-experimental/browser/page/isdisabled/) | Checks if the element is `disabled`. |
34+
| [page.isEditable(selector, [options])](/javascript-api/k6-experimental/browser/page/iseditable/) | Checks if the element is `editable`. |
35+
36+
37+
38+
39+
40+
41+
<!--
42+
| <a href="https://playwright.dev/docs/api/class-page#page-is-enabled" target="_blank" >page.isEnabled(selector[, options])</a> | - | - |
43+
| <a href="https://playwright.dev/docs/api/class-page#page-is-hidden" target="_blank" >page.isHidden(selector[, options])</a> | - | - |
44+
| <a href="https://playwright.dev/docs/api/class-page#page-is-visible" target="_blank" >page.isVisible(selector[, options])</a> | - | - |
45+
| [page.locator(selector\[, options\])](/javascript-api/k6-experimental/browser/locator/) | - | Creates and returns a new page `locator` given a selector with strict mode on. The strict mode only allows selecting a single matching element, and will throw an error if multiple matches are found. |
46+
| <a href="https://playwright.dev/docs/api/class-page#page-main-frame" target="_blank" >page.mainFrame()</a> | - | - |
47+
| <a href="https://playwright.dev/docs/api/class-page#page-opener" target="_blank" >page.opener()</a> | - | - |
48+
| <a href="https://playwright.dev/docs/api/class-page#page-press" target="_blank" >page.press(selector, key[, options])</a> | - | - |
49+
| <a href="https://playwright.dev/docs/api/class-page#page-reload" target="_blank" >page.reload([options])</a> | - | - |
50+
| <a href="https://playwright.dev/docs/api/class-page#page-screenshot" target="_blank" >page.screenshot([options])</a> | - | - |
51+
| <a href="https://playwright.dev/docs/api/class-page#page-select-option" target="_blank" >page.selectOption(selector, values[, options])</a> | - | - |
52+
| <a href="https://playwright.dev/docs/api/class-page#page-set-checked" target="_blank" >page.setChecked(selector, checked[, options])</a> | - | - |
53+
| <a href="https://playwright.dev/docs/api/class-page#page-set-content" target="_blank" >page.setContent(html[, options])</a> | - | - |
54+
| <a href="https://playwright.dev/docs/api/class-page#page-set-default-navigation-timeout" target="_blank" >page.setDefaultNavigationTimeout(timeout)</a> | - | - |
55+
| <a href="https://playwright.dev/docs/api/class-page#page-set-default-timeout" target="_blank" >page.setDefaultTimeout(timeout)</a> | - | - |
56+
| <a href="https://playwright.dev/docs/api/class-page#page-set-extra-http-headers" target="_blank" >page.setExtraHTTPHeaders(headers)</a> | - | - |
57+
| <a href="https://playwright.dev/docs/api/class-page#page-set-input-files" target="_blank" >page.setInputFiles(selector, files[, options])</a> | - | - |
58+
| <a href="https://playwright.dev/docs/api/class-page#page-set-viewport-size" target="_blank" >page.setViewportSize(viewportSize)</a> | - | - |
59+
| <a href="https://playwright.dev/docs/api/class-page#page-tap" target="_blank" >page.tap(selector[, options])</a> | - | - |
60+
| <a href="https://playwright.dev/docs/api/class-page#page-text-content" target="_blank" >page.textContent(selector[, options])</a> | - | - |
61+
| <a href="https://playwright.dev/docs/api/class-page#page-title" target="_blank" >page.title()</a> | - | - |
62+
| <a href="https://playwright.dev/docs/api/class-page#page-type" target="_blank" >page.type(selector, text[, options])</a> | - | - |
63+
| <a href="https://playwright.dev/docs/api/class-page#page-uncheck" target="_blank" >page.uncheck(selector[, options])</a> | - | - |
64+
| <a href="https://playwright.dev/docs/api/class-page#page-unroute" target="_blank" >page.unroute(url[, handler])</a> | - | - |
65+
| <a href="https://playwright.dev/docs/api/class-page#page-url" target="_blank" >page.url()</a> | - | - |
66+
| <a href="https://playwright.dev/docs/api/class-page#page-viewport-size" target="_blank" >page.viewportSize()</a> | - | - |
67+
| <a href="https://playwright.dev/docs/api/class-page#page-wait-for-function" target="_blank" >page.waitForFunction(pageFunction[, arg, options])</a> | - | - |
68+
| <a href="https://playwright.dev/docs/api/class-page#page-wait-for-load-state" target="_blank" >page.waitForLoadState([state, options])</a> | - | - |
69+
| <a href="https://playwright.dev/docs/api/class-page#page-wait-for-navigation" target="_blank" >page.waitForNavigation([options])</a> | - | - |
70+
| <a href="https://playwright.dev/docs/api/class-page#page-wait-for-request" target="_blank" >page.waitForRequest(urlOrPredicate[, options])</a> | - | - |
71+
| <a href="https://playwright.dev/docs/api/class-page#page-wait-for-response" target="_blank" >page.waitForResponse(urlOrPredicate[, options])</a> | - | - |
72+
| <a href="https://playwright.dev/docs/api/class-page#page-wait-for-selector" target="_blank" >page.waitForSelector(selector[, options])</a> | - | - |
73+
| <a href="https://playwright.dev/docs/api/class-page#page-wait-for-timeout" target="_blank" >page.waitForTimeout(timeout)</a> | - | - |
74+
| <a href="https://playwright.dev/docs/api/class-page#page-keyboard" target="_blank" >keyboard</a> | - | - |
75+
| <a href="https://playwright.dev/docs/api/class-page#page-mouse" target="_blank" >mouse</a> | - | - |
76+
| <a href="https://playwright.dev/docs/api/class-page#page-touchscreen" target="_blank" >touchscreen</a> | - | - | -->
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
title: 'bringToFront()'
3+
excerpt: 'Browser module: page.bringToFront method'
4+
---
5+
6+
Activates the browser tab so that it comes into focus and actions can be performed against it.
7+
8+
9+
### Example
10+
11+
<CodeGroup labels={[]}>
12+
13+
```javascript
14+
import { chromium } from 'k6/experimental/browser';
15+
16+
export default async function () {
17+
const browser = chromium.launch();
18+
const page = browser.newPage();
19+
20+
await page.goto('https://test.k6.io/browser.php');
21+
22+
/// perform other actions that might open up a different tab, but not focused.
23+
24+
page.bringToFront();
25+
}
26+
```
27+
28+
</CodeGroup>

0 commit comments

Comments
 (0)