microsoft / microsoft/playwright-java
[Feature] Possibility to configure parameter for code creation through recording
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.6k
- Forks
- 298
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 14
Description
With playwright version 1.27.0 the code that is created through recording has changed completely.
See below the same flow recorded with a recent version and with 1.26.0:

Previously we consistently got "page.locator" entries, now we get a mixture of "page.getBy"... and "page.locator" entries. Additionally we get some entries that are very difficult to read:

So in the current version the recording is not usable to us, as it would create inconsistent selectors. What we are prefering in our project are selectors identify by text and chain back/forward to other text like this:

As every project has different preferences I suggest of introduce a configuration possibilities on created code where you could specfiy things like: "always use the attribute id unless there is a text on the element".
Some ideas for configuration possibilities:
- Use attribute "xy"
- Prefer CSS selectors
- Prefer Labels selectors
- Prefer ARIA roles
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source files, tests, or entry points are named. Start by tracing the recording code-generation path in the Java library and compare the selector output between Playwright 1.27.0 and 1.26.0. Done should include a defined configuration interface for selector preferences and coverage for the requested preference choices.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100