'Using Puppeteer Node library, how to get table data if there are 19 <table> elements with no unique identifiers on the page?
My goal is to get the textContent of a <table> element using Puppeteer Node Library. There are 19 <table> elements on the page. They all have the same .class names and no unique #id.
const tableCount = await page.$$eval('table', (tables) => tables.length);
console.log(tableCount)
19
Solution 1:[1]
Use https://css-tricks.com/almanac/selectors/n/nth-child/
<section class="grid">
<article class="module">One</article>
<article class="module">Two</article>
<article class="module">Three</article>
<article class="module">Four</article>
<article class="module">Five</article>
</section>
.module:nth-child(4n) {
margin-right: 0;
}```
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | DalexHD |
