0.1.1 • Published 10 years ago

phantomstig v0.1.1

Weekly downloads
9
License
-
Repository
github
Last release
10 years ago

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