I'm trying to capture the information from a table but this table has a pagination button ("next , prev"). When I click the next button, no navigation occurs; it just creates a POST request that returns a new HTML table.
When I click the next button that causes a POST (not navigation), how can I wait to this POST to finish before trying to capture the data again from the next page?
Maybe I can detect some changes in the table element, but I don't know how.
What is the best approach for this problem?
Right now I'm doing this:
while (await page.$(NEXT_BUTTON_SELECTOR) !== null) {
await page.click(NEXT_BUTTON_SELECTOR);
await page.waitFor(2 * 1000);
pageTableArray = getData();
}
but I'm not convinced that this is a good way to do it.