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

# FrameLocator

FrameLocator represents a way to find element(s) in an `iframe`. Frames can be nested, and this locator supports selecting a frame element and then working with it.

A FrameLocator can be created with the [page.frameLocator(selector)](/docs/k6/latest/javascript-api/k6-browser/page/framelocator/) method or the [locator.contentFrame()](/docs/k6/latest/javascript-api/k6-browser/locator/contentframe/) method.

Expand table

| Method                                                                                                                 | Description                                                                                                                                            |
|------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------|
| [frameLocator(selector)](/docs/k6/latest/javascript-api/k6-browser/framelocator/framelocator/)                         | Returns a [FrameLocator](/docs/k6/latest/javascript-api/k6-browser/framelocator/) for a nested iframe matching the given `selector` within this frame. |
| [getByAltText(altText\[, options\])](/docs/k6/latest/javascript-api/k6-browser/framelocator/getbyalttext/)             | Returns a locator for elements with the specified `alt` attribute text.                                                                                |
| [getByLabel(text\[, options\])](/docs/k6/latest/javascript-api/k6-browser/framelocator/getbylabel/)                    | Returns a locator for form controls with the specified label text.                                                                                     |
| [getByPlaceholder(placeholder\[, options\])](/docs/k6/latest/javascript-api/k6-browser/framelocator/getbyplaceholder/) | Returns a locator for input elements with the specified `placeholder` attribute text.                                                                  |
| [getByRole(role\[, options\])](/docs/k6/latest/javascript-api/k6-browser/framelocator/getbyrole/)                      | Returns a locator for elements with the specified ARIA role.                                                                                           |
| [getByTestId(testId)](/docs/k6/latest/javascript-api/k6-browser/framelocator/getbytestid/)                             | Returns a locator for elements with the specified `data-testid` attribute.                                                                             |
| [getByText(text\[, options\])](/docs/k6/latest/javascript-api/k6-browser/framelocator/getbytext/)                      | Returns a locator for elements containing the specified text.                                                                                          |
| [getByTitle(title\[, options\])](/docs/k6/latest/javascript-api/k6-browser/framelocator/getbytitle/)                   | Returns a locator for elements with the specified `title` attribute.                                                                                   |
| [locator(selector\[, options\])](/docs/k6/latest/javascript-api/k6-browser/framelocator/locator/)                      | Returns a new chained `locator` for the given `selector` within the frame.                                                                             |
