Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Default to text selectors for Playwright #167

Closed
RyKilleen opened this issue Sep 29, 2021 · 3 comments
Closed

Default to text selectors for Playwright #167

RyKilleen opened this issue Sep 29, 2021 · 3 comments
Assignees
Labels
🦾 enhancement New feature or request ❓ question Further information is requested

Comments

@RyKilleen
Copy link

RyKilleen commented Sep 29, 2021

Is it technically feasible to default to something like button:has-text("Log In") instead of incredibly long, unmaintainable selectors? Some way of defaulting to the shortest text-based selector when possible? I'd love to be able to use this extension while also following Playwright's best practices of using text in all possible cases.

@ianaya89
Copy link
Contributor

@RyKilleen did you try (or is possible for you) to use a data attribute?
You can set something like data-testid to your HTML elements and then configure the extension to use it in the options page.
Once is enabled, data attributes will take precedence over other selectors.

@ianaya89 ianaya89 self-assigned this Sep 30, 2021
@ianaya89 ianaya89 added the ❓ question Further information is requested label Sep 30, 2021
@ianaya89 ianaya89 added the 🦾 enhancement New feature or request label Nov 1, 2021
@dolfje
Copy link
Contributor

dolfje commented Nov 9, 2021

With pull request #178 it is possible to set a custom resolver. In the pull request, you can also find code that you have to set as custom resolver

@checkly checkly deleted a comment from mex511511mno Nov 18, 2021
@checkly checkly deleted a comment from mex511511mno Nov 18, 2021
@RyKilleen RyKilleen reopened this Mar 10, 2022
@ianaya89
Copy link
Contributor

#232

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
🦾 enhancement New feature or request ❓ question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants