SyntaxError: Unmatched selector: tbody tr
See original GitHub issueI’m using cheerio js 1.0.0-rc.3 to scrape a website. I also tried with 1.0.0-rc.2. Both have the same behavior
console.log($('table tbody tr'))
Above console is printing all objects. However, when I tried to loop through the elements, like given below
$('table tbody tr').each(function (index, element) {
}
I’m getting the following error.
SyntaxError: Unmatched selector: tbody tr
Any insight on this error will be great help
Edit
Given below is the table structure I’m trying to scrape.
<table border="1" cellspacing="1" cellpadding="1" class="table table-striped" style="font-weight:bold">
<thead>
<tr>
<th><strong>Heading</strong></th>
<th><strong>Heading</strong></th>
<th><strong>Heading</strong></th>
<th><strong>Heading</strong></th>
<th><strong>Heading</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td>row 1 col 1</td>
<td>row 1 col 2</td>
<td>row 1 col 3</td>
<td>row 1 col 4</td>
<td>row 1 col 5</td>
</tr>
<tr>
<td>row 2 col 1</td>
<td>row 2 col 2</td>
<td>row 2 col 3</td>
<td>row 2 col 4</td>
<td>row 2 col 5</td>
</tr>
</tbody>
</table>
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top Results From Across the Web
SyntaxError: Unmatched selector: '.next' · Issue #710 - GitHub
Selector : div#pagination a.results:has('.next') [ERROR] 11:32:40 SyntaxError SyntaxError: Unmatched selector: '.next' at parse ...
Read more >Cheerio unmatched selector error while selecting plain text
map see the 'TEXT WITHOUT TAG', it throws an error like this: Unmatched selector: ... Which is expected because it hasn't any selectors....
Read more >jquery.js
1793 markFunction(function( seed, matches ) { 1794 var idx, 1795 matched = fn( seed, ... 1859 // http://www.w3.org/TR/selectors/#lang-pseudo 1860 "lang": ...
Read more >Team:Imperial College/Resources/JS:JQuery - iGEM 2016
Build a new jQuery matched element set var ret = jQuery.merge( ... Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors attributes ...
Read more >Converse.js API Documentation Source: headless/dist ...
Let n be the number given in // the first cell of the same row. ... Sizzle.tokenize = function( selector, parseOnly ) {...
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
I am puzzled, it still working.
My entire test code:
and my results are:
so all items are there
and I used cheerio version “1.0.0-rc.3” from npm.
Used https://www.npmjs.com/package/node-html-parser instead