{"repo":"jtassin/pending-xhr-puppeteer","free":true,"listed":false,"github":"https://github.com/jtassin/pending-xhr-puppeteer","clone":"git clone https://github.com/jtassin/pending-xhr-puppeteer.git","description":"Small tool to wait that all xhr are finished in puppeteer","language":"TypeScript","stars":276,"topics":["puppeteer","nodejs","e2e-tests","e2e","xhr"],"license":"MIT","category":"scrapers-browser-automation","readme_excerpt":"Pending XHR Puppeteer Introduction Installation Usage Contribute Introduction Pending XHR Puppeteer is a tool that detect when there is xhr requests not yet finished. You can use it to have a xhr requests count or to wait for all xhr requests to be finished. Installation To install with yarn : To install with npm : Usage wait for all xhr requests to be finished Get the number of pending xhr Usage with Promise.race If you need to wait xhrs but not longer than a specific time, You can race pending-xhr-puppeteer and setTimeout in a Promise.race . Wait for all xhr triggered by all the events of the page You can use this lib to wait for xhr triggered by any event from the UI (click, typing, ...). Exemple : This mode is usefull to test SPA, you d'ont have to recreate a new instance at each time. The request listeners will be deleted when you leave the page. Wait for all xhr triggered by an event of the page with waitOnceForAllXhrFinished you can wait until all the xhr are finished and them remove the listeners. This is usefull when waitForAllXhrFinished has a leaking behaviour for you. Exemple : Contribute Merge requests and issues are welcome.","default_branch":null,"files":null,"tree":[],"storefront":"/r/jtassin","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/jtassin/pending-xhr-puppeteer/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}