Closed roccomuso closed 5 years ago
That's because it's not implemented in Cheerio. See https://github.com/cheeriojs/cheerio/issues/362
On Tue, Apr 25, 2017 at 7:21 PM, Rocco Musolino notifications@github.com wrote:
Selector: :visible
How can I use the :visible in the selector? I'm getting an error from cheerio. Are there some workaround? I'm my sample I have 3 div, and one of them got the .active class. (For some reason the selector on the .active class doesn't work (either on jQuery), and I've been able to get it just using the jQuery :visible attr. environment:
- version of node: 4.4.0
Steps to reproduce
selector: .hello .world:visible Expected behaviour
Select that element. Actual behaviour
Cheerio raise an error: [SyntaxError: unmatched pseudo-class :visible]
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/matthewmueller/x-ray/issues/258, or mute the thread https://github.com/notifications/unsubscribe-auth/AAYAK3aP-rcnMlKjlrDebctNDLFxcW_iks5rziutgaJpZM4NHzKH .
any workaround?
You might have some luck with using a Nightmare driver instead of the standard Cheerio, since Nightmare apparently supports visibility selector .
Having said that, I have no idea if the x-ray nightmare driver exposes this functionality, etc. Never used it.
On Tue, Apr 25, 2017 at 9:45 PM, Rocco Musolino notifications@github.com wrote:
any workaround?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/matthewmueller/x-ray/issues/258#issuecomment-297143495, or mute the thread https://github.com/notifications/unsubscribe-auth/AAYAK9IXDAj0i9FeUKCd6QX_zrvjw_eCks5rzk1BgaJpZM4NHzKH .
Because cheerio is a parser, not a browser, it doesn't have knowledge of this. Should work in any headless browser.
Selector:
:visible
How can I use the
:visible
in the selector? I'm getting an error from cheerio. Are there some workaround? I'm my sample I have 3div
, and one of them got the.active
class. (For some reason the selector on the.active
class doesn't work (either on jQuery), and I've been able to get it just using the jQuery:visible
attr.environment:
Steps to reproduce
selector:
.hello .world:visible
Expected behaviour
Select that element.
Actual behaviour
Cheerio raise an error:
[SyntaxError: unmatched pseudo-class :visible]