Important: This documentation is about an older version. It's relevant only to the release noted, many of the features and functions have been updated or replaced. Please view the current version.

Open source RSS

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) method or the locator.contentFrame() method.

MethodDescription
frameLocator(selector)Returns a FrameLocator for a nested iframe matching the given selector within this frame.
getByAltText(altText[, options])Returns a locator for elements with the specified alt attribute text.
getByLabel(text[, options])Returns a locator for form controls with the specified label text.
getByPlaceholder(placeholder[, options])Returns a locator for input elements with the specified placeholder attribute text.
getByRole(role[, options])Returns a locator for elements with the specified ARIA role.
getByTestId(testId)Returns a locator for elements with the specified data-testid attribute.
getByText(text[, options])Returns a locator for elements containing the specified text.
getByTitle(title[, options])Returns a locator for elements with the specified title attribute.
locator(selector[, options])Returns a new chained locator for the given selector within the frame.