---
title: "Frame | Grafana k6 documentation"
description: "Browser module: Frame Class"
---

# Frame

Frame represents a single frame in a browser window. It can be a top-level frame or an iframe. Frames are used to organize content in a browser window. Frames can be nested, and each frame has its own document and window objects.

Expand table

| Method                                                                                                                                                          | Description                                                                                                                            |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------|
| [$(selector)](/docs/k6/latest/javascript-api/k6-browser/frame/frame-dollar/)                                                                                    | Finds an element matching the specified `selector` within the frame.                                                                   |
| [$$(selector)](/docs/k6/latest/javascript-api/k6-browser/frame/frame-doubledollar/)                                                                             | Finds all elements matching the specified `selector` within the frame.                                                                 |
| [check(selector\[, options\])](/docs/k6/latest/javascript-api/k6-browser/frame/check/)                                                                          | Select the input checkbox.                                                                                                             |
| [childFrames()](/docs/k6/latest/javascript-api/k6-browser/frame/childframes/)                                                                                   | Returns an array of child frames.                                                                                                      |
| [click(selector\[, options\])](/docs/k6/latest/javascript-api/k6-browser/frame/click/)                                                                          | Clicks on an element matching a `selector`.                                                                                            |
| [content()](/docs/k6/latest/javascript-api/k6-browser/frame/content/)                                                                                           | Gets the HTML contents of the frame.                                                                                                   |
| [dblclick(selector\[, options\])](/docs/k6/latest/javascript-api/k6-browser/frame/dblclick/)                                                                    | Double click on an element matching the provided `selector`.                                                                           |
| [dispatchEvent(selector, type, eventInit\[, options\])](/docs/k6/latest/javascript-api/k6-browser/frame/dispatchevent/)                                         | Dispatches HTML DOM event types e.g. `'click'`                                                                                         |
| [evaluate(pageFunction\[, arg\])](/docs/k6/latest/javascript-api/k6-browser/frame/evaluate/)                                                                    | Returns the value of the `pageFunction` invocation.                                                                                    |
| [evaluateHandle(pageFunction\[, arg\])](/docs/k6/latest/javascript-api/k6-browser/frame/evaluatehandle/)                                                        | Returns the value of the `pageFunction` invocation as a [JSHandle](/docs/k6/latest/javascript-api/k6-browser/jshandle/).               |
| [fill(selector, value\[, options\])](/docs/k6/latest/javascript-api/k6-browser/frame/fill/)                                                                     | Fill an `input`, `textarea` or `contenteditable` element with the provided value.                                                      |
| [focus(selector\[, options\])](/docs/k6/latest/javascript-api/k6-browser/frame/focus/)                                                                          | Fetches an element with `selector` and focuses on it.                                                                                  |
| [frameElement()](/docs/k6/latest/javascript-api/k6-browser/frame/frameelement/)                                                                                 | Returns the `frame`’s `element`.                                                                                                       |
| [frameLocator(selector)](/docs/k6/latest/javascript-api/k6-browser/frame/framelocator/)                                                                         | Returns a [FrameLocator](/docs/k6/latest/javascript-api/k6-browser/framelocator/) for the nested iframe matching the given `selector`. |
| [getAttribute(selector, name\[, options\])](/docs/k6/latest/javascript-api/k6-browser/frame/getattribute/)                                                      | Returns the element attribute value for the given attribute name.                                                                      |
| [getByAltText(altText\[, options\])](/docs/k6/latest/javascript-api/k6-browser/frame/getbyalttext/)                                                             | Returns a locator for elements with the specified `alt` attribute text.                                                                |
| [getByLabel(text\[, options\])](/docs/k6/latest/javascript-api/k6-browser/frame/getbylabel/)                                                                    | Returns a locator for form controls with the specified label text.                                                                     |
| [getByPlaceholder(placeholder\[, options\])](/docs/k6/latest/javascript-api/k6-browser/frame/getbyplaceholder/)                                                 | Returns a locator for input elements with the specified `placeholder` attribute text.                                                  |
| [getByRole(role\[, options\])](/docs/k6/latest/javascript-api/k6-browser/frame/getbyrole/)                                                                      | Returns a locator for elements with the specified ARIA role.                                                                           |
| [getByTestId(testId)](/docs/k6/latest/javascript-api/k6-browser/frame/getbytestid/)                                                                             | Returns a locator for elements with the specified `data-testid` attribute.                                                             |
| [getByText(text\[, options\])](/docs/k6/latest/javascript-api/k6-browser/frame/getbytext/)                                                                      | Returns a locator for elements containing the specified text.                                                                          |
| [getByTitle(title\[, options\])](/docs/k6/latest/javascript-api/k6-browser/frame/getbytitle/)                                                                   | Returns a locator for elements with the specified `title` attribute.                                                                   |
| [goto(url\[, options\])](/docs/k6/latest/javascript-api/k6-browser/frame/goto/)                                                                                 | Navigates to the specified `url`.                                                                                                      |
| [hover(selector\[, options\])](/docs/k6/latest/javascript-api/k6-browser/frame/hover/)                                                                          | Hovers over an element matching `selector`.                                                                                            |
| [innerHTML(selector\[, options\])](/docs/k6/latest/javascript-api/k6-browser/frame/innerhtml/)                                                                  | Returns the `element.innerHTML`.                                                                                                       |
| [innerText(selector\[, options\])](/docs/k6/latest/javascript-api/k6-browser/frame/innertext/)                                                                  | Returns the `element.innerText`.                                                                                                       |
| [inputValue(selector\[, options\])](/docs/k6/latest/javascript-api/k6-browser/frame/inputvalue/)                                                                | Returns `input.value` for the selected `input`, `textarea` or `select` element.                                                        |
| [isChecked(selector\[, options\])](/docs/k6/latest/javascript-api/k6-browser/frame/ischecked/)                                                                  | Checks to see if the `checkbox` `input` type is selected or not.                                                                       |
| [isDetached()](/docs/k6/latest/javascript-api/k6-browser/frame/isdetached/)                                                                                     | Returns `true` if the frame is detached from the DOM.                                                                                  |
| [isDisabled(selector\[, options\])](/docs/k6/latest/javascript-api/k6-browser/frame/isdisabled/)                                                                | Checks if the element is `disabled`.                                                                                                   |
| [isEditable(selector\[, options\])](/docs/k6/latest/javascript-api/k6-browser/frame/iseditable/)                                                                | Checks if the element is `editable`.                                                                                                   |
| [isEnabled(selector\[, options\])](/docs/k6/latest/javascript-api/k6-browser/frame/isenabled/)                                                                  | Checks if the element is `enabled`.                                                                                                    |
| [isHidden(selector\[, options\])](/docs/k6/latest/javascript-api/k6-browser/frame/ishidden/)                                                                    | Checks if the matched element is `hidden`.                                                                                             |
| [isVisible(selector\[, options\])](/docs/k6/latest/javascript-api/k6-browser/frame/isvisible/)                                                                  | Checks if the matched element is `visible`.                                                                                            |
| [locator(selector\[, options\])](/docs/k6/latest/javascript-api/k6-browser/frame/locator/)                                                                      | Returns a [Locator](/docs/k6/latest/javascript-api/k6-browser/locator/) for the given `selector`.                                      |
| [name()](/docs/k6/latest/javascript-api/k6-browser/frame/name/)                                                                                                 | Returns the name of the frame.                                                                                                         |
| [page()](/docs/k6/latest/javascript-api/k6-browser/frame/page/)                                                                                                 | Returns the page containing the frame.                                                                                                 |
| [parentFrame()](/docs/k6/latest/javascript-api/k6-browser/frame/parentframe/)                                                                                   | Returns the parent frame, if any.                                                                                                      |
| [press(selector, key\[, options\])](/docs/k6/latest/javascript-api/k6-browser/frame/press/)                                                                     | Focuses the element, and then presses the given `key` on the [Keyboard](/docs/k6/latest/javascript-api/k6-browser/keyboard/).          |
| [selectOption(selector, values\[, options\])](/docs/k6/latest/javascript-api/k6-browser/frame/selectoption/)                                                    | Selects one or more options which match the values from a `<select>` element.                                                          |
| [setContent(html\[, options\])](/docs/k6/latest/javascript-api/k6-browser/frame/setcontent/)                                                                    | Sets the supplied HTML string to the current frame.                                                                                    |
| [setInputFiles(selector, file\[, options\])](/docs/k6/latest/javascript-api/k6-browser/frame/setinputfiles/)                                                    | Sets the file input element’s value to the specified files.                                                                            |
| [setChecked(selector, checked\[, options\])](/docs/k6/latest/javascript-api/k6-browser/frame/setchecked/)                                                       | Sets the `checkbox` or `radio` input element’s value to the specified checked or unchecked state.                                      |
| [tap(selector\[, options\])](/docs/k6/latest/javascript-api/k6-browser/frame/tap/) [](https://github.com/grafana/xk6-browser/issues/436)                        | Taps the first element that matches the `selector`.                                                                                    |
| [textContent(selector\[, options\])](/docs/k6/latest/javascript-api/k6-browser/frame/textcontent/)                                                              | Returns the `element.textContent`.                                                                                                     |
| [title()](/docs/k6/latest/javascript-api/k6-browser/frame/title/)                                                                                               | Returns the title of the frame.                                                                                                        |
| [type(selector, text\[, options\])](/docs/k6/latest/javascript-api/k6-browser/frame/type/)                                                                      | Types the `text` in the first element found that matches the `selector`.                                                               |
| [uncheck(selector\[, options\])](/docs/k6/latest/javascript-api/k6-browser/frame/uncheck/)                                                                      | Unchecks an input `checkbox` element.                                                                                                  |
| [url()](/docs/k6/latest/javascript-api/k6-browser/frame/url/)                                                                                                   | Returns the `frame`’s URL.                                                                                                             |
| [waitForFunction(pageFunction, arg\[, options\])](/docs/k6/latest/javascript-api/k6-browser/frame/waitforfunction/)                                             | Returns when the `pageFunction` returns a truthy value.                                                                                |
| [waitForLoadState(state\[, options\])](/docs/k6/latest/javascript-api/k6-browser/frame/waitforloadstate/) [](https://github.com/grafana/xk6-browser/issues/880) | Waits for the given load `state` to be reached.                                                                                        |
| [waitForNavigation(\[options\])](/docs/k6/latest/javascript-api/k6-browser/frame/waitfornavigation/)                                                            | Waits for the given navigation lifecycle event to occur and returns the main resource response.                                        |
| [waitForSelector(selector\[, options\])](/docs/k6/latest/javascript-api/k6-browser/frame/waitforselector/)                                                      | Returns when element specified by selector satisfies `state` option.                                                                   |
| [waitForTimeout(timeout)](/docs/k6/latest/javascript-api/k6-browser/frame/waitfortimeout/)                                                                      | Waits for the given `timeout` in milliseconds.                                                                                         |
| [waitForURL(url\[, options\])](/docs/k6/latest/javascript-api/k6-browser/frame/waitforurl/)                                                                     | Waits for the frame to navigate to the specified URL.                                                                                  |
