Menu
Open source

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

MethodDescription
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.