Skip to content

Provide an alternate way of locating an element in codegen #27875

Open
@wolispace

Description

@wolispace

When testing content from a CMS the content is constantly changing, so we can't rely on the text of an element.

Eg : Test clicking on the first search results .. but codegen only give me something like:

await page.getByRole('link', { name: 'Blue carbon futures' }).click();

It would be great if it gave me the best practice way of finding the first item in the list so that can be clicked on eg:

await page.locator(".search_results > li > a ").first().click();

Is there any chance it can be be put into a 'no text match' mode where it relies on class names and dom element relationships instead of matching text that can (and often does) change?

Thanks

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions