[Feature] `text=` selector to match <input type="text" placeholder="This is placeholder">
See original GitHub issueIn my opinion one should also consider “placeholder” when searching an element(input) by text. This is because most of the inputs can be identified by placeholders when it does not have a value. Becomes very useful if one needs to fill Text based on input’s placeholder. So test code will look as follows
Element: <input type="text" placeholder="This is placeholder">
Code: await page.fill(text="This is placeholder", "new value")
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:9 (5 by maintainers)
Top Results From Across the Web
::placeholder | CSS-Tricks - CSS-Tricks
:placeholder-shown is for selecting the input itself when it's placeholder text is being shown. As opposed to ::placeholder which styles the ...
Read more >Don't Use The Placeholder Attribute - Smashing Magazine
For someone who has never encountered it before, placeholder text may look like entered content, causing them to skip over the input.
Read more >placeholder - CSS: Cascading Style Sheets - MDN Web Docs
The ::placeholder CSS pseudo-element represents the placeholder text in an <input> or <textarea> element. Try it. HTML Demo: ::placeholder.
Read more >HTML DOM Input Text placeholder Property - W3Schools
The placeholder attribute specifies a short hint that describes the expected value of a text field (e.g. a sample value or a short...
Read more >:placeholder-shown CSS pseudo-class | Can I use... Support ...
Input elements can sometimes show placeholder text as a hint to the user on what to type in. See, for example, the placeholder...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This makes sense. The only question is whether to match placeholder when there is some text in the input?
fill()
which is not ideal.Given that, perhaps leaving it explicit is the best? There would be no surprises, even though you’ll have to write
[placeholder="text"]
.I’ll close this as a part of the bug triaging process. We have hundreds of bugs and feature requests with dozens and even hundreds of upvotes, while this one only has a few thumbs up. Please feel free to open a new bug and link this one if you’d like to see it addressed.