Validate multiple selectors in DOM
See original GitHub issueRelated to question
Is it possible to validate with Puppeteer v1.11.0
(or other approach) what is the first selector in appears of a group of selectors and know which one it was to perform an action?
selector1 = `#user`;
selector2 = `#search`;
selector3 = `#error`;
waitForSelector(selector1 OR selector2 OR selector3)
if(selector1){
//do something
}else if(selector2){
//do other something
}else if(selector3){
//do other other something
}else{
//finally do...
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Using multiple selectors with querySelector(), querySelectorAll ...
// Get's any element with the .sandwich class, and all labels inside the #contact element var elems = document.querySelectorAll('.sandwich, # ...
Read more >Multiple Selector (“selector1, selector2, selectorN”) - jQuery API
This multiple expression combinator is an efficient way to select disparate elements. The order of the DOM elements in the returned jQuery object...
Read more >Document.querySelectorAll() - Web APIs | MDN
A string containing one or more selectors to match against. This string must be a valid CSS selector string; if it's not, a...
Read more >How to determine if I'm selecting multiple or a single element ...
I'm writing a function $ (similar to one of jQuery's $ ), but with non-jQuery methods and helpers, with plain DOM properties. I...
Read more >jQuery - Multiple Elements Selector - Tutorialspoint
You can specify any number of selectors to combine into a single result. Here order of the DOM elements in the jQuery object...
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
Something like this?
how about using
Promise.race()
something like this :await Promise.race([await this.page.$(selector1), await this.page.$(selector2)]);