|
| 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> | - | - | --> |
0 commit comments