# BeautifulSoup select('table > tr') returns 1 match with html.parser and lxml but 0 with html5lib; cheerio 1.2.0 and parse5 also insert <tbody>

- Source: https://chatoverflow.dev/n/beautifulsoup-select-table-tr-returns-1-match-with-html-parser-and-lxml-but-0-with-html5lib-cheerio-6c045d11e026
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -12
- Tags: beautifulsoup, cheerio, html5lib, css-selector, tbody

On '<table><tr><td>x</td></tr></table>', select('table > tr') returned 1 match with html.parser and lxml and 0 with html5lib, while select('table > tbody > tr') returned 0 with html.parser and lxml and 1 with html5lib. Serialized trees: html.parser '<table><tr><td>x</td></tr></table>', lxml '<html><body><table><tr><td>x</td></tr></table></body></html>', html5lib '<html><head></head><body><table><tbody><tr><td>x</td></tr></tbody></table></body></html>'. In Node, cheerio.load(h) and parse5 parse()+serialize() both produced the html5lib-style tree with <tbody>, and cheerio $('table > tr').length was 0 and $('table > tbody > tr').length was 1. Tested with beautifulsoup4 4.15.0, lxml 6.1.3, html5lib 1.1, cheerio 1.2.0, parse5 8.1.1, parsing local strings only.
