Skip to content

ealanisg/x-ray-puppeteer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

x-ray-puppeteer

A modern puppeteer-based driver for x-ray.

Forked from x-ray-phantom.

Installation

// add to package.json
"x-ray-puppeteer": "git+https://[email protected]/ealanisg/x-ray-puppeteer.git#main",

Usage

Basic usage should be the same as request-x-ray:

var puppeteer = require('x-ray-puppeteer');
var Xray = require('x-ray');

var x = Xray()
  .driver(puppeteer());

x('http://google.com', 'title')(function(err, str) {
  if (err) return done(err);
  assert.equal('Google', str);
  done();
})

API

driver([options])

Initialize the puppeteer driver. Returns an X-Ray driver function with the puppeteer instance saved as fn.instance property.

Options

options arg is passed direct to puppeteer. The following are custom options that configure the driver itself:

useragent

Sets a custom User Agent during instance setup via page.setUserAgent() or a default one will be used.

Test

yarn install
yarn test

License

MIT

About

puppeteer driver for x-ray.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%