phantomstig

0.1.1 • Public • Published

PhantomStig

Use PhantomJS in nodejs without having to write so many callback functions.

Dependencies

PhantomJS

Install

npm install phantomstig --save-dev

Example

SearchBing.js

var PhantomStig = require('phantomstig');
var startUrl = 'http://bing.com';
var searchQuery = 'Junior JS';

console.log('Searching bing...');
var stig = new PhantomStig();
stig.open(startUrl);
stig.waitForElement('#sb_form_q');
stig.setElementValue('#sb_form_q', searchQuery);
stig.submitForm('#sb_form');
stig.waitForElement('.sb_tlst');
stig.getText('.sb_tlst', function (text) {
  console.log('This was the top result: "' + text + '"');
});
stig.run();

Run:

> node SearchBing.js

Readme

Keywords

none

Package Sidebar

Install

npm i phantomstig

Weekly Downloads

0

Version

0.1.1

License

none

Last publish

Collaborators

  • justspamjustin