Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
const phantom = require('phantom');
(async function() {
const instance = await phantom.create();
const page = await instance.createPage();
await page.on('onResourceRequested', function(requestData) {
console.info('Requesting', requestData.url);
});
const status = await page.open('https://stackoverflow.com/');
const content = await page.property('content');
console.log(content);
await instance.exit();
})();
Using Node v7.9.0+ you can run the above example with node file.js
See examples folder for more ways to use this module.
Latest version of phantom does require Node v6.x and later. You can install with
$ npm install phantom --save
To use version 3.x you need to have at least Node v5+. You can install it using
$ npm install phantom@3 --save
$ npm install phantom@2 --save
Creating new phantom instances with phantom.create()
can be slow. If
you are frequently creating new instances and destroying them, as a
result of HTTP requests for example, it might be worth creating a pool
of instances that are re-used.
See the phantom-pool module for more info.
To run the test suite, first install the dependencies, then run npm test
:
$ npm install
$ npm test
This package is under development. Pull requests are welcomed. Please make sure tests are added for new functionalities and that your build does pass in TravisCI.
The current lead maintainer is Amir Raminfar
FAQs
PhantomJS integration module for NodeJS
The npm package phantom receives a total of 13,046 weekly downloads. As such, phantom popularity was classified as popular.
We found that phantom demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.