I am using puppeteer for a webcrawler of mine. Sometimes it needs to click gui elements that take time to show up.
It has been bugging me that for every click()
I call I also need to call a timeout manually.
I wondered if it is possible to decorate all the click functions somehow.
As puppeteer is a library I do not instantiate any of these myself, rather they're given from functions such as Page.$(selector)
the click()
is available in multiple classes and all of them will need to have it applied.
What's a good pattern to solve this?