New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can´t select elements based on their position in the document #3547
Comments
What version of Cheerio are you using? Note that positional selectors are only available in the latest RC release. |
I'm using the last version avaible from Google App Script
Em sáb., 16 de dez. de 2023 08:07, Felix Boehm ***@***.***>
escreveu:
… What version of Cheerio are you using? Note that positional selectors are
only available in the latest RC release.
—
Reply to this email directly, view it on GitHub
<#3547 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AE7LFVZJSCF2MOS4RDFLIQDYJV6F3AVCNFSM6AAAAABAW366L6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJYG44TCMBXGQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From https://cheerio.js.org/docs/basics/selecting
Have a command documentation that inform you can select elements based on their position, like
const$p = $ ('p:first');
but if I want select$p = $ ('div div.first button').attr('onclick') it returns null.
if I write just
$('div div button').attr('onclick'),
it returns the first value
Always I need do
$('div div button').each((index,value) =>
$(value).attr('onclick')
(yes, the comand 'each' return the div>div elements).
And discard the 2 first elements to get my value.
I think it be more simple like
$('div div[2] button').attr('onclick')
Selecting the div position with "[2]", like an array element position.
Exist some form that I can't need make the 'each' command to return the values from 3th div?
If I write like the div:second, Google App Script retuns "Error: unmatched pseudo-class :second"
Thanks
The text was updated successfully, but these errors were encountered: