Playwright · Method
page.getByAltText
getByAltText finds an element by its alternative text and returns a Locator. You can optionally require an exact, case-sensitive, whole-string match.
Last updated
- Since
- v1.27
Syntax
page.getByAltText(text)
page.getByAltText(text, options)In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
LocatorFrameLocator.getByAltTextPage.getByAltTextgetByLabelgetByRolegetByText