This package has been deprecated

Author message:

Please use instead pending-xhr-puppeteer package

pending-puppeteer-xhr

1.0.12 • Public • Published

Pending XHR Puppeteer

npm version Build Status

| 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 :

yarn add pending-xhr-puppeteer -D

To install with npm :

npm install pending-xhr-puppeteer --save-dev

Usage

wait for all xhr requests to be finished

const puppeteer = require('puppeteer');
const { PendingXHR } = require('pending-xhr-puppeteer');
 
const browser = await puppeteer.launch({
  headless: true,
  args,
});
 
const page = await browser.newPage();
const pendingXHR = new PendingXHR(page);
await page.goto(`http://page-with-xhr`);
// Here all xhr requests are not finished
await pendingXHR.waitForAllXhrFinished();
// Here all xhr requests are finished

Get the number of pending xhr

const puppeteer = require('puppeteer');
const { PendingXHR } = require('pending-xhr-puppeteer');
 
const browser = await puppeteer.launch({
  headless: true,
  args,
});
 
const page = await browser.newPage();
const pendingXHR = new PendingXHR(page);
await page.goto(`http://page-with-xhr`);
console.log(pendingXHR.pendingXhrCount());
// Display the number of xhr pending

Contribute

git clone https://github.com/jtassin/pending-xhr-puppeteer.git
cd pending-xhr-puppeteer
yarn
yarn test

Merge requests and issues are welcome.

Package Sidebar

Install

npm i pending-puppeteer-xhr

Weekly Downloads

0

Version

1.0.12

License

MIT

Unpacked Size

12.8 kB

Total Files

15

Last publish

Collaborators

  • jtassin