Skip to content

[Feature]: Playwright to intelligently identify alternate locators during run time #34985

Open
@sundar-ds

Description

@sundar-ds

🚀 Feature Request

Many a times I find on the web application I test, the locators change. For e.g., if my code currently has

get_by_role("textbox", name="Name")

the page in somecases based on the data available changes it to:

get_by_label("Name)

The underlying page structure becomes different for the same field based on the data or other elements present. This makes the code fail.

Is it possible that playwright dynamically identifies which is the best locator to use based on the page structure? Is there any other way to implement these kinda of changes currently?

Example

No response

Motivation

I often face the issue of the underlying page structure changing although in the visible UI there's no difference. This results in frequent failures of the playwright code.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions