I want to use Puppeteer to respond to page updates.
The page shows items and when I leave the page open new items can appear over time.
E.g. every 10 seconds a new item is added.
I can use the following to wait for an item on the initial load of the page:
await page.waitFor(".item");
console.log("the initial items have been loaded")
How can I wait for / catch future items?
I would like to achieve something like this (pseudo code):
await page.goto('http://mysite');
await page.waitFor(".item");
// check items (=these initial items)
// event when receiving new items:
// check item(s) (= the additional [or all] items)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…