{"_id":"phantom-proxy","_rev":"87-474ab33c6292c65e4b05a8c35628f187","name":"phantom-proxy","description":"a lightweight proxy that lets you to drive phantomjs from node.","dist-tags":{"latest":"0.1.792"},"versions":{"0.0.1":{"author":{"name":"Rob Schieber","email":"rob.schieber@gmail.com","url":"https://twitter.com/sheebz"},"dependencies":{"should":"~1.2.0","mocha":"~1.5.0","colors":"~0.6.0-1","q":"~0.8.8","underscore":"~1.4.0","qs":"0.5.1","form-data":"~0.0.3","mime":"~1.2.7"},"devDependencies":{"should":"~1.2.0","mocha":"~1.5.0"},"engines":{"node":">0.6.0"},"name":"phantom-proxy","private":false,"version":"0.0.1","contributors":[],"repository":{"type":"git","url":"https://github.com/sheebz/phantom-proxy"},"readme":"phantom-proxy\n=============\n\nnodejs proxy for phantomjs headless webkit browser","_id":"phantom-proxy@0.0.1","description":"phantom-proxy =============","dist":{"shasum":"2d90837782e8c31d3cdb010539708c1a3dd7b4b9","tarball":"https://registry.npmjs.org/phantom-proxy/-/phantom-proxy-0.0.1.tgz","integrity":"sha512-3eamdfJ+lSvTmS/HsWOidQJL2aUOjkcKRVjbvJlzSOU0fH0PPG/ODaPLFS5YuPlybwClrC2EluqGOah5WUn++A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAyysofqqnSUpDtpw8WNMSpNkTZRROazv0jomYjctehFAiEAjuRvI/ZSG2mzfF3j2WguGB7H+gVLHEBB7B4Mq4dTNME="}]},"maintainers":[{"name":"sheebz","email":"rob.schieber@gmail.com"}]},"0.0.2":{"author":{"name":"Rob Schieber","email":"rob.schieber@gmail.com","url":"https://twitter.com/sheebz"},"dependencies":{"should":"~1.2.0","mocha":"~1.5.0","colors":"~0.6.0-1","q":"~0.8.8","underscore":"~1.4.0","qs":"0.5.1","form-data":"~0.0.3","mime":"~1.2.7"},"main":"phantom-proxy.js","devDependencies":{"should":"~1.2.0","mocha":"~1.5.0"},"bugs":{"mail":"rob.schieber@gmail.com","url":" https://github.com/sheebz/phantom-proxy/issues"},"licenses":[{"type":"MIT","url":"https://github.com/sheebz/phantom-proxy/blob/master/README.md"}],"keywords":["phantom","phantomjs","phantom-node","node-phantom","feature","test","headless","webkit"],"engines":{"node":">0.6.0"},"directories":{"test":"./test","lib":"./lib"},"name":"phantom-proxy","private":false,"version":"0.0.2","description":"A set of proxy objects for driving  phantomjs from node","repository":{"type":"git","url":"https://github.com/sheebz/phantom-proxy"},"readme":"# phantom-proxy\nProvides a proxy interface for phantomjs which runs inside of node.  Now you can run phantom and access the full api from within nodejs.\n\n## Overview\nPhantomJs is an incredibly useful tool for functional and unit testing.  Problem is that it runs in its own process which is outside of node, so you are basically out of luck if you want to integrate with phantomjs from within node.  There are some other libraries - phantom-node, node-phantom, that address the same problem.  \n\n## Why do we need another nodejs runtime for phantom?\nPhantom-proxy takes a different approach to communicating with phantom than these modules.  Phantom-node passes messages using alerts and express.  While this was an ingenious solution to a difficult problem at the time, better solutions are now available.  As of version 1.4, phantomjs provides an embedded webserver called mongoose which can be used to pass messages.  Phantom-proxy leverages this, which is the fastst and most reliable approach.\n\n##Instalation\n`npm install phantom-proxy` \n\n##usage\n\n```javascript\nphantomProxy = require('phantom-proxy');\nphantomProxy.createProxy({}, function (proxy) {\n    proxy.page.onConsoleMessage = function (event) {\n        console.log(JSON.stringify(event));\n    };\n    proxy.page.open('http://www.google.com', function () {\n        proxy.page.waitForSelector('body', function () {\n            proxy.page.render('./scratch/loginTest.png', function () {\n                proxy.phantom.exit(function () {\n                    console.log('test complete');\n                });\n            });\n        });\n    });\n});\n```\n\n","_id":"phantom-proxy@0.0.2","dist":{"shasum":"2ff45e40ccdbccda402f27492179986118a41382","tarball":"https://registry.npmjs.org/phantom-proxy/-/phantom-proxy-0.0.2.tgz","integrity":"sha512-cq6xMmFJxTIE5E+smHMoKjKKlNbDLMImdBcQAM+ov8qbFy6111ZqjCcyhx7xc92ZF7A75gMOc6cYD3Inbk8bpg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDSb0WOQPTS00WnP6cTWz4HJeuQlXiUcN35lKdDw2bXmAiEAkEA2QTCCHZnvdXCS1hhfMYznlA4gkq5Ps9xQtwyf0mw="}]},"maintainers":[{"name":"sheebz","email":"rob.schieber@gmail.com"}]},"0.0.3":{"author":{"name":"Rob Schieber","email":"rob.schieber@gmail.com","url":"https://twitter.com/sheebz"},"dependencies":{"should":"~1.2.0","mocha":"~1.5.0","colors":"~0.6.0-1","q":"~0.8.8","underscore":"~1.4.0","qs":"0.5.1","form-data":"~0.0.3","mime":"~1.2.7"},"main":"phantom-proxy.js","devDependencies":{"should":"~1.2.0","mocha":"~1.5.0"},"bugs":{"mail":"rob.schieber@gmail.com","url":" https://github.com/sheebz/phantom-proxy/issues"},"licenses":[{"type":"MIT","url":"https://github.com/sheebz/phantom-proxy/blob/master/README.md"}],"keywords":["phantom","phantomjs","phantom-node","node-phantom","feature","test","headless","webkit"],"engines":{"node":">0.6.0"},"directories":{"test":"./test","lib":"./lib"},"name":"phantom-proxy","private":false,"version":"0.0.3","description":"A set of proxy objects for driving  phantomjs from node","repository":{"type":"git","url":"https://github.com/sheebz/phantom-proxy"},"readme":"# phantom-proxy\nProvides a proxy interface for phantomjs which runs inside of node.  Now you can run phantom and access the full api from within nodejs.\n\n## Overview\nPhantomJs is an incredibly useful tool for functional and unit testing.  Problem is that it runs in its own process which is outside of node, so you are basically out of luck if you want to integrate with phantomjs from within node.  There are some other libraries - phantom-node, node-phantom, that address the same problem.  \n\n## Why do we need another nodejs runtime for phantom?\nPhantom-proxy takes a different approach to communicating with phantom than these modules.  Phantom-node passes messages using alerts and express.  While this was an ingenious solution to a difficult problem at the time, better solutions are now available.  As of version 1.4, phantomjs provides an embedded webserver called mongoose which can be used to pass messages.  Phantom-proxy leverages this, which is the fastst and most reliable approach.\n\n##Instalation\n`npm install phantom-proxy` \n\n##usage\n\n```javascript\nphantomProxy = require('phantom-proxy');\nphantomProxy.createProxy({}, function (proxy) {\n    proxy.page.onConsoleMessage = function (event) {\n        console.log(JSON.stringify(event));\n    };\n    proxy.page.open('http://www.google.com', function () {\n        proxy.page.waitForSelector('body', function () {\n            proxy.page.render('./scratch/loginTest.png', function () {\n                proxy.phantom.exit(function () {\n                    console.log('test complete');\n                });\n            });\n        });\n    });\n});\n```\n\n","_id":"phantom-proxy@0.0.3","dist":{"shasum":"cb65d81b94e1a7d7dfb04a2cbe3e83cede666f18","tarball":"https://registry.npmjs.org/phantom-proxy/-/phantom-proxy-0.0.3.tgz","integrity":"sha512-D9xyb/19AqBItncuVrlbfFe0wFqXFzaa+g1dK+EiuZn5Ng5I6sVoBAREjKZb6o9pYGSgHt3/LATk8uibpyj2HQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDeligwzOhL/e4SOYqQCxzVNBh3CoCnpmhfHUusC+qeUAiAEc6RGU5G7xbF/QN6P8aJFkYV6B22kF3UhRi4JMXCv/Q=="}]},"maintainers":[{"name":"sheebz","email":"rob.schieber@gmail.com"}]},"0.1.0":{"author":{"name":"Rob Schieber","email":"rob.schieber@gmail.com","url":"https://twitter.com/sheebz"},"dependencies":{"should":"~1.2.0","mocha":"~1.5.0","colors":"~0.6.0-1","q":"~0.8.8","underscore":"~1.4.0","qs":"0.5.1","form-data":"~0.0.3","mime":"~1.2.7"},"main":"phantom-proxy.js","devDependencies":{"should":"~1.2.0","mocha":"~1.5.0"},"bugs":{"mail":"rob.schieber@gmail.com","url":" https://github.com/sheebz/phantom-proxy/issues"},"licenses":[{"type":"MIT","url":"https://github.com/sheebz/phantom-proxy/blob/master/README.md"}],"keywords":["phantom","phantomjs","phantom-node","node-phantom","feature","test","headless","webkit"],"engines":{"node":">0.6.0"},"directories":{"test":"./test","lib":"./lib"},"name":"phantom-proxy","private":false,"version":"0.1.0","description":"A set of proxy objects for driving  phantomjs from node","repository":{"type":"git","url":"https://github.com/sheebz/phantom-proxy"},"readme":"# phantom-proxy\nProvides a proxy interface for phantomjs which runs inside of node.  Now you can run phantom and access the full api from within nodejs.\n\n## Overview\nPhantomJs is an incredibly useful tool for functional and unit testing.  Problem is that it runs in its own process which is outside of node, so you are basically out of luck if you want to integrate with phantomjs from within node.  There are some other libraries - phantom-node, node-phantom, that address the same problem.  \n\n## Why do we need another nodejs runtime for phantom?\nPhantom-proxy takes a different approach to communicating with phantom than these modules.  Phantom-node passes messages using alerts and express.  While this was an ingenious solution to a difficult problem at the time, better solutions are now available.  As of version 1.4, phantomjs provides an embedded webserver called mongoose which can be used to pass messages.  Phantom-proxy leverages this, which is the fastst and most reliable approach.\n\n##Instalation\n`npm install phantom-proxy` \n\n##usage\n\n```javascript\nphantomProxy = require('phantom-proxy');\nphantomProxy.createProxy({}, function (proxy) {\n    proxy.page.onConsoleMessage = function (event) {\n        console.log(JSON.stringify(event));\n    };\n    proxy.page.open('http://www.google.com', function () {\n        proxy.page.waitForSelector('body', function () {\n            proxy.page.render('./scratch/loginTest.png', function () {\n                proxy.phantom.exit(function () {\n                    console.log('test complete');\n                });\n            });\n        });\n    });\n});\n```\n\n","_id":"phantom-proxy@0.1.0","dist":{"shasum":"41f18544e3af5ead0714e9cdf5e39bd8a69f80ec","tarball":"https://registry.npmjs.org/phantom-proxy/-/phantom-proxy-0.1.0.tgz","integrity":"sha512-MAUfh3GnaiM33hq3oD8AEK1mWr+RViE1oozcXIh/j/5Ui3C2XNE+J3MuA+cXYKyUdXQwZ/IWCkeJppFYSWS6qQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDNJm50ew7ss1bLPJeIYyQXOj7KC5LPVLLef0pt8tk7uwIhAPECLdfXlGAPZHr5RyY8V+EOrJsV8oUI63xnmhWL36q5"}]},"_npmVersion":"1.1.62","_npmUser":{"name":"sheebz","email":"rob.schieber@gmail.com"},"maintainers":[{"name":"sheebz","email":"rob.schieber@gmail.com"}]},"0.1.1":{"author":{"name":"Rob Schieber","email":"rob.schieber@gmail.com","url":"https://twitter.com/sheebz"},"dependencies":{"should":"~1.2.0","mocha":"~1.5.0","colors":"~0.6.0-1","q":"~0.8.8","underscore":"~1.4.0","qs":"0.5.1","form-data":"~0.0.3","mime":"~1.2.7"},"main":"phantom-proxy.js","devDependencies":{"should":"~1.2.0","mocha":"~1.5.0"},"bugs":{"mail":"rob.schieber@gmail.com","url":" https://github.com/sheebz/phantom-proxy/issues"},"licenses":[{"type":"MIT","url":"https://github.com/sheebz/phantom-proxy/blob/master/README.md"}],"keywords":["phantom","phantomjs","phantom-node","node-phantom","feature","test","headless","webkit"],"engines":{"node":">0.6.0"},"directories":{"test":"./test","lib":"./lib"},"name":"phantom-proxy","private":false,"version":"0.1.1","description":"A set of proxy objects for driving  phantomjs from node","repository":{"type":"git","url":"https://github.com/sheebz/phantom-proxy"},"readme":"# phantom-proxy\nProvides a proxy interface for phantomjs which runs inside of node.  Now you can run phantom and access the full api from within nodejs.\n\n## Overview\nPhantomJs is an incredibly useful tool for functional and unit testing.  Problem is that it runs in its own process which is outside of node, so you are basically out of luck if you want to integrate with phantomjs from within node.  There are some other libraries - phantom-node, node-phantom, that address the same problem.  \n\n## Why do we need another nodejs runtime for phantom?\nPhantom-proxy takes a different approach to communicating with phantom than these modules.  Phantom-node passes messages using alerts and express.  While this was an ingenious solution to a difficult problem at the time, better solutions are now available.  As of version 1.4, phantomjs provides an embedded webserver called mongoose which can be used to pass messages.  Phantom-proxy leverages this, which is the fastst and most reliable approach.\n\n##Instalation\n`npm install phantom-proxy` \n\n##usage\n\n```javascript\nphantomProxy = require('phantom-proxy');\nphantomProxy.createProxy({}, function (proxy) {\n    proxy.page.onConsoleMessage = function (event) {\n        console.log(JSON.stringify(event));\n    };\n    proxy.page.open('http://www.google.com', function () {\n        proxy.page.waitForSelector('body', function () {\n            proxy.page.render('./scratch/loginTest.png', function () {\n                proxy.phantom.exit(function () {\n                    console.log('test complete');\n                });\n            });\n        });\n    });\n});\n```\n\n","_id":"phantom-proxy@0.1.1","dist":{"shasum":"220d0f30e3726e57098cb3944d9d0fddf78e361e","tarball":"https://registry.npmjs.org/phantom-proxy/-/phantom-proxy-0.1.1.tgz","integrity":"sha512-HuzJtgVffbBNkID1aIPtS7PgLVNlFjpTapIN3SCoC/tT3u3Vv1SNdAbzFP3XQuFKIAlfx0KntGBJRXbTpnYesw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCt7/ZF7lT6kuV5wv/Up9JUFBay2OdT2KQ+EuEkMWtKrQIgCinEdnUvDiwc6MmATIou6qYPw5oyJ2o53DZUA8QsDlE="}]},"_npmVersion":"1.1.62","_npmUser":{"name":"sheebz","email":"rob.schieber@gmail.com"},"maintainers":[{"name":"sheebz","email":"rob.schieber@gmail.com"}]},"0.1.3":{"author":{"name":"Rob Schieber","email":"rob.schieber@gmail.com","url":"https://twitter.com/sheebz"},"dependencies":{"colors":"~0.6.0-1","q":"~0.8.8","underscore":"~1.4.0","form-data":"~0.0.3","mime":"~1.2.7"},"main":"phantom-proxy.js","devDependencies":{"should":"~1.2.0","mocha":"~1.5.0","cucumber":">0.0.0"},"bugs":{"mail":"rob.schieber@gmail.com","url":" https://github.com/sheebz/phantom-proxy/issues"},"licenses":[{"type":"MIT","url":"https://github.com/sheebz/phantom-proxy/blob/master/README.md"}],"keywords":["phantom","phantomjs","phantom-node","node-phantom","feature","test","headless","webkit","cucumber"],"engines":{"node":">0.6.0"},"directories":{"test":"./test","lib":"./lib","example":"./example"},"name":"phantom-proxy","private":false,"version":"0.1.3","description":"A set of proxy objects for driving  phantomjs from node","repository":{"type":"git","url":"https://github.com/sheebz/phantom-proxy"},"readme":"# phantom-proxy\nProvides a proxy interface for phantomjs which runs inside of node.  Now you can run phantom and access the full api from within nodejs.\n\n## Overview\nPhantomJs is an incredibly useful tool for functional and unit testing.  Problem is that it runs in its own process which is outside of node, so you are basically out of luck if you want to integrate with phantomjs from within node.  There are some other libraries - phantom-node, node-phantom, that address the same problem.  \n\n## Why do we need another nodejs runtime for phantom?\nPhantom-proxy takes a different approach to communicating with phantom than these modules.  Phantom-node passes messages using alerts and express.  While this was an ingenious solution to a difficult problem at the time, better solutions are now available.  As of version 1.4, phantomjs provides an embedded webserver called mongoose which can be used to pass messages.  Phantom-proxy leverages this, which is the fastst and most reliable approach.\n\n##Instalation\n`npm install phantom-proxy` \n\n##usage\n\n```javascript\nphantomProxy = require('phantom-proxy');\nphantomProxy.createProxy({}, function (proxy) {\n    proxy.page.onConsoleMessage = function (event) {\n        console.log(JSON.stringify(event));\n    };\n    proxy.page.open('http://www.google.com', function () {\n        proxy.page.waitForSelector('body', function () {\n            proxy.page.render('./scratch/loginTest.png', function () {\n                proxy.phantom.exit(function () {\n                    console.log('test complete');\n                });\n            });\n        });\n    });\n});\n```\n\n","_id":"phantom-proxy@0.1.3","dist":{"shasum":"28d822a9a1a1d17aed5e768708382ebadf227d31","tarball":"https://registry.npmjs.org/phantom-proxy/-/phantom-proxy-0.1.3.tgz","integrity":"sha512-L5HJem+co2KLUJUsuHAfNFfOSrnM0TZZs5zMZ4XzbDFy2k5igtkNVJXTMxX96DKjhF6tVjYZ1c5sfhITv4d86A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDpU0SCSz2BP6e92/gDryd/R3wjZDJP2XMFn0HuAmSR7wIhAN001TjzuJAKCUWa1ybrXdd9FCgedkC+fb+dQ60N6XMV"}]},"_npmVersion":"1.1.62","_npmUser":{"name":"sheebz","email":"rob.schieber@gmail.com"},"maintainers":[{"name":"sheebz","email":"rob.schieber@gmail.com"}]},"0.1.4":{"author":{"name":"Rob Schieber","email":"rob.schieber@gmail.com","url":"https://twitter.com/sheebz"},"dependencies":{"colors":"~0.6.0-1","q":"~0.8.8","underscore":"~1.4.0","form-data":"~0.0.3","mime":"~1.2.7"},"main":"index.js","devDependencies":{"should":"~1.2.0","mocha":"~1.5.0","cucumber":">0.0.0"},"bugs":{"mail":"rob.schieber@gmail.com","url":" https://github.com/sheebz/phantom-proxy/issues"},"licenses":[{"type":"MIT","url":"https://github.com/sheebz/phantom-proxy/blob/master/README.md"}],"keywords":["phantom","phantomjs","phantom-node","node-phantom","feature","test","headless","webkit","cucumber"],"engines":{"node":">0.6.0"},"directories":{"test":"./test","lib":"./lib","example":"./example"},"name":"phantom-proxy","private":false,"version":"0.1.4","description":"A set of proxy objects for driving  phantomjs from node","repository":{"type":"git","url":"https://github.com/sheebz/phantom-proxy"},"readme":"# phantom-proxy\nProvides a proxy interface for phantomjs which runs inside of node.  Now you can run phantom and access the full api from within nodejs.\n\n## Overview\nPhantomJs is an incredibly useful tool for functional and unit testing.  Problem is that it runs in its own process which is outside of node, so you are basically out of luck if you want to integrate with phantomjs from within node.  There are some other libraries - phantom-node, node-phantom, that address the same problem.  \n\n## Why do we need another nodejs runtime for phantom?\nPhantom-proxy takes a different approach to communicating with phantom than these modules.  Phantom-node passes messages using alerts and express.  While this was an ingenious solution to a difficult problem at the time, better solutions are now available.  As of version 1.4, phantomjs provides an embedded webserver called mongoose which can be used to pass messages.  Phantom-proxy leverages this, which is the fastst and most reliable approach.\n\n##Instalation\n`npm install phantom-proxy` \n\n##usage\n\n```javascript\nphantomProxy = require('phantom-proxy');\nphantomProxy.createProxy({}, function (proxy) {\n    proxy.page.onConsoleMessage = function (event) {\n        console.log(JSON.stringify(event));\n    };\n    proxy.page.open('http://www.google.com', function () {\n        proxy.page.waitForSelector('body', function () {\n            proxy.page.render('./scratch/loginTest.png', function () {\n                proxy.phantom.exit(function () {\n                    console.log('test complete');\n                });\n            });\n        });\n    });\n});\n```\n\n","_id":"phantom-proxy@0.1.4","dist":{"shasum":"2c347796ff7080a1341d51bb4fdd67f55dc78df2","tarball":"https://registry.npmjs.org/phantom-proxy/-/phantom-proxy-0.1.4.tgz","integrity":"sha512-HSh4YTGPlTFFgAVOIm7rtNaJG4coVxvsKYEev0+a0sn9Y1as4xbmfOUbV2jkNAmVcQ9JP79ar8aDZgmemSHQjA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCK9mEDfQIXHuL5kuXYaLA+KV6iBdN6pcBtuApex5q3rAIgTh4ImqW02NWk/YoK/v3JJR76Sgwu2jxfeXQB6qUp5Ps="}]},"_npmVersion":"1.1.62","_npmUser":{"name":"sheebz","email":"rob.schieber@gmail.com"},"maintainers":[{"name":"sheebz","email":"rob.schieber@gmail.com"}]},"0.1.5":{"author":{"name":"Rob Schieber","email":"rob.schieber@gmail.com","url":"https://twitter.com/sheebz"},"dependencies":{"colors":"~0.6.0-1","q":"~0.8.8","underscore":"~1.4.0","form-data":"~0.0.3","mime":"~1.2.7"},"main":"index.js","devDependencies":{"should":"~1.2.0","mocha":"~1.5.0","cucumber":">0.0.0"},"bugs":{"mail":"rob.schieber@gmail.com","url":" https://github.com/sheebz/phantom-proxy/issues"},"licenses":[{"type":"MIT","url":"https://github.com/sheebz/phantom-proxy/blob/master/README.md"}],"keywords":["phantom","phantomjs","phantom-node","node-phantom","feature","test","headless","webkit","cucumber"],"engines":{"node":">0.6.0"},"directories":{"test":"./test","lib":"./lib","example":"./example"},"name":"phantom-proxy","private":false,"version":"0.1.5","description":"A set of proxy objects for driving  phantomjs from node","repository":{"type":"git","url":"https://github.com/sheebz/phantom-proxy"},"readme":"# phantom-proxy\nProvides a proxy interface for phantomjs which runs inside of node.  Now you can run phantom and access the full api from within nodejs.\n\n## Overview\nPhantomJs is an incredibly useful tool for functional and unit testing.  Problem is that it runs in its own process which is outside of node, so you are basically out of luck if you want to integrate with phantomjs from within node.  There are some other libraries - phantom-node, node-phantom, that address the same problem.  \n\n\n## Installation\n`npm install phantom-proxy` \n\n## Usage\n### API\n#### phantomProxy object\n##### CreateProxy(options, callbackFn)\nuse this method to create an instance of the phantom proxy objects.  The return value will be an object with a page proxy and a phantom proxy.  These properties correspond to the phantom and webpage objects on the native phantom API.  \n\nWhen this method is called, a new phantomjs process is spawned.  The new phantomjs process creates a mongoose webserver on localhost:1061.  All subsequent communication with phantom occurs via http requests. \n```javascript\nrequire('phantom-proxy').createProxy({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  \n});\n```\n\n#### Phantom Object\nThe phantom object corresponds to the phantom object in the native phantomJs API.\n#### exit(callbackFn)\nTerminates phantom webserver and destroys proxy.\n```javascript\nrequire('phantom-proxy').createProxy({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  \n  page.open('http://www.w3.org', function(){\n    console.log('page now open');\n    phantom.exit(function(){\n      console.log('phantom proxy is now offline');\n    });\n  }); \n});\n```\n\n#### Page Object\nThe page object corresponds to the webpage object in the native phantomJs API.\n##### open(url, callbackFn)\nOpens a webpage with url and callback function arguments.\n```javascript\nrequire('phantom-proxy').createProxy({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  \n  page.open('http://www.w3.org', function(){\n    console.log('page now open');\n  });  \n  \n});\n```\n##### waitForSelector(selector, callbackFn)\nPolls page for presence of selector, executes callback when selector is present.\n```javascript\nrequire('phantom-proxy').createProxy({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  \n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n    });\n    console.log('page now open');\n  });  \n  \n});\n```\n\n##### render(fileName, callbackFn)\nRenders a image of browser.\n```javascript\nrequire('phantom-proxy').createProxy({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  \n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n      page.render('myimage.png', function(){\n        console.log('saved my picture!');\n      });\n    });\n    console.log('page now open');\n  });  \n  \n});\n```\n\n##### evaluate(functionToEvaluate, callbackFn, [arg1, arg2,... argN]\nExecutes functionToEvaluate in phantomJS browser.  Once function executes, callbackFn will be invoked with a result parameter. The Third and sebsequent arguments represent optional parameters which will be passed to the functionToEvaluate function when it is invoked in the browser.\n\n#### Events\n#### Subscribing to events\n```javascript\nphantomProxy = require('phantom-proxy');\nphantomProxy.createProxy({}, function (proxy) {\n    proxy.page.onConsoleMessage = function (event) {\n        console.log(JSON.stringify(event));\n    };\n});\n```\n\n## FAQ\n### Why do we need another nodejs runtime for phantom?\nPhantom-proxy takes a different approach to communicating with phantom than these modules.  Phantom-node passes messages using alerts and express.  While this was an ingenious solution to a difficult problem at the time, better solutions are now available.  As of version 1.4, phantomjs provides an embedded webserver called mongoose which can be used to pass messages.  Phantom-proxy leverages this, which is the fastst and most reliable approach.\n\n\n\n","_id":"phantom-proxy@0.1.5","dist":{"shasum":"09712e150357edc953b4dc0ff591bfb7f90623fe","tarball":"https://registry.npmjs.org/phantom-proxy/-/phantom-proxy-0.1.5.tgz","integrity":"sha512-PeNuVa95WmO1HT+LmHDDPXtcvBTQlpCH0uYG36bucZfgHxr1Vdso6OgZso+yWKC4FCIsWaQYXY+qIxAvbqXsIA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC+KCEgg0xwdqQlSLjEgUTG+DjnNij2J4nYLK6D2GyZhAIhAP1F2KhXWTa9o8GaJnw1lX3iTRq70YzLqYvAjPAMjCch"}]},"_npmVersion":"1.1.62","_npmUser":{"name":"sheebz","email":"rob.schieber@gmail.com"},"maintainers":[{"name":"sheebz","email":"rob.schieber@gmail.com"}]},"0.1.6":{"author":{"name":"Rob Schieber","email":"rob.schieber@gmail.com","url":"https://twitter.com/sheebz"},"dependencies":{"colors":"~0.6.0-1","q":"~0.8.8","underscore":"~1.4.0","form-data":"~0.0.3","mime":"~1.2.7"},"main":"index.js","devDependencies":{"should":"~1.2.0","mocha":"~1.5.0","cucumber":">0.0.0"},"bugs":{"mail":"rob.schieber@gmail.com","url":" https://github.com/sheebz/phantom-proxy/issues"},"licenses":[{"type":"MIT","url":"https://github.com/sheebz/phantom-proxy/blob/master/README.md"}],"keywords":["phantom","phantomjs","phantom-node","node-phantom","feature","test","headless","webkit","cucumber"],"engines":{"node":">0.6.0"},"directories":{"test":"./test","lib":"./lib","example":"./example"},"name":"phantom-proxy","private":false,"version":"0.1.6","description":"A set of proxy objects for driving  phantomjs from node","repository":{"type":"git","url":"https://github.com/sheebz/phantom-proxy"},"readme":"# phantom-proxy\nProvides a proxy interface for phantomjs which runs inside of node.  Now you can run phantom and access the full api from within nodejs.\n\n## Overview\nPhantomJs is an incredibly useful tool for functional and unit testing.  Problem is that it runs in its own process which is outside of node, so you are basically out of luck if you want to integrate with phantomjs from within node.  There are some other libraries - phantom-node, node-phantom, that address the same problem.  \n\n\n## Installation\n`npm install phantom-proxy` \n\n## Usage\n### API\n#### phantomProxy object\n##### createProxy(options, callbackFn)\nuse this method to create an instance of the phantom proxy objects.  The return value will be an object with a page proxy and a phantom proxy.  These properties correspond to the phantom and webpage objects on the native phantom API.  \n\nWhen this method is called, a new phantomjs process is spawned.  The new phantomjs process creates a mongoose webserver on localhost:1061.  All subsequent communication with phantom occurs via http requests. \n```javascript\nrequire('phantom-proxy').createProxy({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  \n});\n```\n\n#### phantom Object\nThe phantom object corresponds to the phantom object in the native phantomJs API.\n#### exit(callbackFn)\nTerminates phantom webserver and destroys proxy.\n```javascript\nrequire('phantom-proxy').createProxy({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  \n  page.open('http://www.w3.org', function(){\n    console.log('page now open');\n    phantom.exit(function(){\n      console.log('phantom proxy is now offline');\n    });\n  }); \n});\n```\n\n#### Page Object\nThe page object corresponds to the webpage object in the native phantomJs API.\n\n##### set(propertyName, propertyValue, callbackFn)\nsets property on page object\n```javascript\n                //set viewport size for browser window\n                proxy.page.set('viewportSize', \n                { width:320, height:480 }, function (result) {\n                    console.log(result.toString().cyan);\n                    worldCallback.call(self);\n                })\n```\n##### open(url, callbackFn)\nOpens a webpage with url and callback function arguments.\n```javascript\nrequire('phantom-proxy').createProxy({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  \n  page.open('http://www.w3.org', function(){\n    console.log('page now open');\n  });  \n  \n});\n```\n##### waitForSelector(selector, callbackFn)\nPolls page for presence of selector, executes callback when selector is present.\n```javascript\nrequire('phantom-proxy').createProxy({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  \n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n    });\n    console.log('page now open');\n  });  \n  \n});\n```\n\n##### render(fileName, callbackFn)\nRenders a image of browser.\n```javascript\nrequire('phantom-proxy').createProxy({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  \n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n      page.render('myimage.png', function(){\n        console.log('saved my picture!');\n      });\n    });\n    console.log('page now open');\n  });  \n  \n});\n```\n##### renderBase64(type, callbackFn)\nReturns a base64 representation of image. \n\n##### evaluate(functionToEvaluate, callbackFn, [arg1, arg2,... argN]\nExecutes functionToEvaluate in phantomJS browser.  Once function executes, callbackFn will be invoked with a result parameter. The Third and sebsequent arguments represent optional parameters which will be passed to the functionToEvaluate function when it is invoked in the browser.\n\n#### Events\n#### Subscribing to events\n```javascript\nphantomProxy = require('phantom-proxy');\nphantomProxy.createProxy({}, function (proxy) {\n    proxy.page.onConsoleMessage = function (event) {\n        console.log(JSON.stringify(event));\n    };\n});\n```\n\n## FAQ\n### Why do we need another nodejs runtime for phantom?\nPhantom-proxy takes a different approach to communicating with phantom than these modules.  Phantom-node passes messages using alerts and express.  While this was an ingenious solution to a difficult problem at the time, better solutions are now available.  As of version 1.4, phantomjs provides an embedded webserver called mongoose which can be used to pass messages.  Phantom-proxy leverages this, which is the fastst and most reliable approach.\n\n\n\n","_id":"phantom-proxy@0.1.6","dist":{"shasum":"db2320f434b0ea20eef0d3c3ad4eb983209064ba","tarball":"https://registry.npmjs.org/phantom-proxy/-/phantom-proxy-0.1.6.tgz","integrity":"sha512-3zwibVS0EQjmOr4qKNoNXPE/4OuXkqPYUhpBf3/KdpGJky/ISCE90VDBmlBlAAF3Zp6rcC3tzH3YSD3hJpcKKw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC36Ih5JwV1JZ3ENXRRW0AfCwVf5FQilHJWpzrZPQxOjQIgREg+AF2bU8qg/IW3fwc7Fu9Zf4LLsztrcbeVCw5XrLU="}]},"_npmVersion":"1.1.62","_npmUser":{"name":"sheebz","email":"rob.schieber@gmail.com"},"maintainers":[{"name":"sheebz","email":"rob.schieber@gmail.com"}]},"0.1.7":{"author":{"name":"Rob Schieber","email":"rob.schieber@gmail.com","url":"https://twitter.com/sheebz"},"dependencies":{"colors":"~0.6.0-1","q":"~0.8.8","underscore":"~1.4.0","form-data":"~0.0.3","mime":"~1.2.7"},"main":"index.js","devDependencies":{"should":"~1.2.0","mocha":"~1.5.0","cucumber":">0.0.0"},"bugs":{"mail":"rob.schieber@gmail.com","url":" https://github.com/sheebz/phantom-proxy/issues"},"licenses":[{"type":"MIT","url":"https://github.com/sheebz/phantom-proxy/blob/master/README.md"}],"keywords":["phantom","phantomjs","phantom-node","node-phantom","feature","test","headless","webkit","cucumber"],"engines":{"node":">0.6.0"},"directories":{"test":"./test","lib":"./lib","example":"./example"},"name":"phantom-proxy","private":false,"version":"0.1.7","description":"A set of proxy objects for driving  phantomjs from node","repository":{"type":"git","url":"https://github.com/sheebz/phantom-proxy"},"readme":"# phantom-proxy\nProvides a proxy interface for phantomjs which runs inside of node.  Now you can run phantom and access the full api from within nodejs.\n\n## Overview\nPhantomJs is an incredibly useful tool for functional and unit testing.  Problem is that it runs in its own process which is outside of node, so you are basically out of luck if you want to integrate with phantomjs from within node.  There are some other libraries - phantom-node, node-phantom, that address the same problem.  \n\n\n## Installation\n`npm install phantom-proxy` \n\n## Usage\n### API\n#### phantomProxy object\n##### createProxy(options, callbackFn)\nuse this method to create an instance of the phantom proxy objects.  The return value will be an object with a page proxy and a phantom proxy.  These properties correspond to the phantom and webpage objects on the native phantom API.  \n\nWhen this method is called, a new phantomjs process is spawned.  The new phantomjs process creates a mongoose webserver on localhost:1061.  All subsequent communication with phantom occurs via http requests. \n```javascript\nrequire('phantom-proxy').createProxy({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  \n});\n```\n\n#### phantom Object\nThe phantom object corresponds to the phantom object in the native phantomJs API.\n#### exit(callbackFn)\nTerminates phantom webserver and destroys proxy.\n```javascript\nrequire('phantom-proxy').createProxy({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  \n  page.open('http://www.w3.org', function(){\n    console.log('page now open');\n    phantom.exit(function(){\n      console.log('phantom proxy is now offline');\n    });\n  }); \n});\n```\n\n#### Page Object\nThe page object corresponds to the webpage object in the native phantomJs API.\n\n##### set(propertyName, propertyValue, callbackFn)\nsets property on page object\n```javascript\n                //set viewport size for browser window\n                proxy.page.set('viewportSize', \n                { width:320, height:480 }, function (result) {\n                    console.log(result.toString().cyan);\n                    worldCallback.call(self);\n                })\n```\n##### open(url, callbackFn)\nOpens a webpage with url and callback function arguments.\n```javascript\nrequire('phantom-proxy').createProxy({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  \n  page.open('http://www.w3.org', function(){\n    console.log('page now open');\n  });  \n  \n});\n```\n##### waitForSelector(selector, callbackFn)\nPolls page for presence of selector, executes callback when selector is present.\n```javascript\nrequire('phantom-proxy').createProxy({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  \n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n    });\n    console.log('page now open');\n  });  \n  \n});\n```\n\n##### render(fileName, callbackFn)\nRenders a image of browser.\n```javascript\nrequire('phantom-proxy').createProxy({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  \n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n      page.render('myimage.png', function(){\n        console.log('saved my picture!');\n      });\n    });\n    console.log('page now open');\n  });  \n  \n});\n```\n##### renderBase64(type, callbackFn)\nReturns a base64 representation of image. \n\n##### evaluate(functionToEvaluate, callbackFn, [arg1, arg2,... argN]\nExecutes functionToEvaluate in phantomJS browser.  Once function executes, callbackFn will be invoked with a result parameter. The Third and sebsequent arguments represent optional parameters which will be passed to the functionToEvaluate function when it is invoked in the browser.\n\n#### Events\n#### Subscribing to events\n```javascript\nphantomProxy = require('phantom-proxy');\nphantomProxy.createProxy({}, function (proxy) {\n    proxy.page.onConsoleMessage = function (event) {\n        console.log(JSON.stringify(event));\n    };\n});\n```\n\n## FAQ\n### Why do we need another nodejs runtime for phantom?\nPhantom-proxy takes a different approach to communicating with phantom than these modules.  Phantom-node passes messages using alerts and express.  While this was an ingenious solution to a difficult problem at the time, better solutions are now available.  As of version 1.4, phantomjs provides an embedded webserver called mongoose which can be used to pass messages.  Phantom-proxy leverages this, which is the fastst and most reliable approach.\n\n\n\n","_id":"phantom-proxy@0.1.7","dist":{"shasum":"0fa550b7d145b99b6a05d882b1a71541dcfdf28d","tarball":"https://registry.npmjs.org/phantom-proxy/-/phantom-proxy-0.1.7.tgz","integrity":"sha512-MGsPQQBxJAVzV6igY5MZaM5nf/B9ifoxk/UPfu429AIS01NuT7j7Xw3MEqNXzVlrltCo03OVnFfXGWCP3mq2sQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCCgePUAsXQ/UJUQHGyauIhWlg4xYlWJGDn39s7RHb4zgIgDCst/u9wzs3tzaGZPY0mpMiV4gJkJ5AkI+rM9qVW818="}]},"_npmVersion":"1.1.62","_npmUser":{"name":"sheebz","email":"rob.schieber@gmail.com"},"maintainers":[{"name":"sheebz","email":"rob.schieber@gmail.com"}]},"0.1.8":{"author":{"name":"Rob Schieber","email":"rob.schieber@gmail.com","url":"https://twitter.com/sheebz"},"bugs":{"mail":"rob.schieber@gmail.com","url":" https://github.com/sheebz/phantom-proxy/issues"},"dependencies":{"colors":"~0.6.0-1","form-data":"~0.0.3","mime":"~1.2.7","q":"~0.8.8","underscore":"~1.4.0"},"description":"A set of proxy objects for driving  phantomjs from node","devDependencies":{"cucumber":">0.0.0","mocha":"~1.5.0","should":"~1.2.0"},"directories":{"example":"./example","lib":"./lib","test":"./test"},"engines":{"node":">0.6.0"},"keywords":["phantom","phantomjs","phantom-node","node-phantom","feature","test","headless","webkit","cucumber"],"licenses":[{"type":"MIT","url":"https://github.com/sheebz/phantom-proxy/blob/master/README.md"}],"main":"index.js","name":"phantom-proxy","private":false,"repository":{"type":"git","url":"https://github.com/sheebz/phantom-proxy"},"version":"0.1.8","readme":"# phantom-proxy\nProvides a proxy interface for phantomjs which runs inside of node.  Now you can run phantom and access the full api from within nodejs.\n\n## Overview\nPhantomJs is an incredibly useful tool for functional and unit testing.  Problem is that it runs in its own process which is outside of node, so you are basically out of luck if you want to integrate with phantomjs from within node.  There are some other libraries - phantom-node, node-phantom, that address the same problem.  \n\n\n## Installation\n`npm install phantom-proxy` \n\n## Usage\n### API\n#### phantomProxy object\n##### createProxy(options, callbackFn)\nuse this method to create an instance of the phantom proxy objects.  The return value will be an object with a page proxy and a phantom proxy.  These properties correspond to the phantom and webpage objects on the native phantom API.  \n\nWhen this method is called, a new phantomjs process is spawned.  The new phantomjs process creates a mongoose webserver on localhost:1061.  All subsequent communication with phantom occurs via http requests. \n```javascript\nrequire('phantom-proxy').createProxy({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  \n});\n```\n\n#### phantom Object\nThe phantom object corresponds to the phantom object in the native phantomJs API.\n#### exit(callbackFn)\nTerminates phantom webserver and destroys proxy.\n```javascript\nrequire('phantom-proxy').createProxy({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  \n  page.open('http://www.w3.org', function(){\n    console.log('page now open');\n    phantom.exit(function(){\n      console.log('phantom proxy is now offline');\n    });\n  }); \n});\n```\n\n#### Page Object\nThe page object corresponds to the webpage object in the native phantomJs API.\n\n##### set(propertyName, propertyValue, callbackFn)\nsets property on page object\n```javascript\n                //set viewport size for browser window\n                proxy.page.set('viewportSize', \n                { width:320, height:480 }, function (result) {\n                    console.log(result.toString().cyan);\n                    worldCallback.call(self);\n                })\n```\n##### open(url, callbackFn)\nOpens a webpage with url and callback function arguments.\n```javascript\nrequire('phantom-proxy').createProxy({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  \n  page.open('http://www.w3.org', function(){\n    console.log('page now open');\n  });  \n  \n});\n```\n##### waitForSelector(selector, callbackFn)\nPolls page for presence of selector, executes callback when selector is present.\n```javascript\nrequire('phantom-proxy').createProxy({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  \n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n    });\n    console.log('page now open');\n  });  \n  \n});\n```\n\n##### render(fileName, callbackFn)\nRenders a image of browser.\n```javascript\nrequire('phantom-proxy').createProxy({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  \n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n      page.render('myimage.png', function(){\n        console.log('saved my picture!');\n      });\n    });\n    console.log('page now open');\n  });  \n  \n});\n```\n##### renderBase64(type, callbackFn)\nReturns a base64 representation of image. \n\n##### evaluate(functionToEvaluate, callbackFn, [arg1, arg2,... argN]\nExecutes functionToEvaluate in phantomJS browser.  Once function executes, callbackFn will be invoked with a result parameter. The Third and sebsequent arguments represent optional parameters which will be passed to the functionToEvaluate function when it is invoked in the browser.\n\n#### Events\n#### Subscribing to events\n```javascript\nphantomProxy = require('phantom-proxy');\nphantomProxy.createProxy({}, function (proxy) {\n    proxy.page.onConsoleMessage = function (event) {\n        console.log(JSON.stringify(event));\n    };\n});\n```\n\n## FAQ\n### Why do we need another nodejs runtime for phantom?\nPhantom-proxy takes a different approach to communicating with phantom than these modules.  Phantom-node passes messages using alerts and express.  While this was an ingenious solution to a difficult problem at the time, better solutions are now available.  As of version 1.4, phantomjs provides an embedded webserver called mongoose which can be used to pass messages.  Phantom-proxy leverages this, which is the fastst and most reliable approach.\n\n\n\n","_id":"phantom-proxy@0.1.8","dist":{"shasum":"e4f92adfecbe696766293c1c8a1b5c6c9032078c","tarball":"https://registry.npmjs.org/phantom-proxy/-/phantom-proxy-0.1.8.tgz","integrity":"sha512-jcY6qyEYQzyarHoSCkr7aA3hsHwfwThCVk8DV2W2hZSNw/SGxaGRY9wHtigdmhnsV3L10ZUYLSJFWbC1ZuP0iA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFdAL0g6BVeK8H5waJQgyD8Qq/U2YV+OMvuZjVtdbMPpAiEAnAKqD0jmWeHZYd7SCeBuM+fTg0/uKPXx9wSlwCSabXk="}]},"_npmVersion":"1.1.62","_npmUser":{"name":"sheebz","email":"rob.schieber@gmail.com"},"maintainers":[{"name":"sheebz","email":"rob.schieber@gmail.com"}]},"0.1.9":{"author":{"name":"Rob Schieber","email":"rob.schieber@gmail.com","url":"https://twitter.com/sheebz"},"bugs":{"mail":"rob.schieber@gmail.com","url":" https://github.com/sheebz/phantom-proxy/issues"},"dependencies":{"colors":"~0.6.0-1","form-data":"~0.0.3","mime":"~1.2.7","q":"~0.8.8","underscore":"~1.4.0"},"description":"A set of proxy objects for driving  phantomjs from node","devDependencies":{"cucumber":">0.0.0","mocha":"~1.5.0","should":"~1.2.0"},"directories":{"example":"./example","lib":"./lib","test":"./test"},"engines":{"node":">0.6.0"},"keywords":["phantom","driver","node","phantomjs","phantom-node","node-phantom","feature","test","headless","webkit","cucumber"],"licenses":[{"type":"MIT","url":"https://github.com/sheebz/phantom-proxy/blob/master/README.md"}],"main":"index.js","name":"phantom-proxy","private":false,"repository":{"type":"git","url":"https://github.com/sheebz/phantom-proxy"},"version":"0.1.9","readme":"# phantom-proxy\nProvides a proxy interface for phantomjs which runs inside of node.  Now you can run phantom and access the full api from within nodejs.\n\n## Overview\nPhantomJs is an incredibly useful tool for functional and unit testing.  Problem is that it runs in its own process which is outside of node, so you are basically out of luck if you want to integrate with phantomjs from within node.  There are some other libraries - phantom-node, node-phantom, that address the same problem.  \n\n\n## Installation\n`npm install phantom-proxy` \n\n## Usage\n### API\n#### phantomProxy object\n##### create(options, callbackFn)\nuse this method to create an instance of the phantom proxy objects.  The return value will be an object with a page proxy and a phantom proxy.  These properties correspond to the phantom and webpage objects on the native phantom API.  \n\nWhen this method is called, a new phantomjs process is spawned.  The new phantomjs process creates a mongoose webserver on localhost:1061.  All subsequent communication with phantom occurs via http requests. \n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  \n});\n```\n\n#### phantom Object\nThe phantom object corresponds to the phantom object in the native phantomJs API.\n#### exit(callbackFn)\nTerminates phantom webserver and destroys proxy.\n```javascript\nrequire('phantom-proxy').createProxy({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  \n  page.open('http://www.w3.org', function(){\n    console.log('page now open');\n    phantom.exit(function(){\n      console.log('phantom proxy is now offline');\n    });\n  }); \n});\n```\n\n#### Page Object\nThe page object corresponds to the webpage object in the native phantomJs API.\n\n##### set(propertyName, propertyValue, callbackFn)\nsets property on page object\n```javascript\n                //set viewport size for browser window\n                proxy.page.set('viewportSize', \n                { width:320, height:480 }, function (result) {\n                    console.log(result.toString().cyan);\n                    worldCallback.call(self);\n                })\n```\n##### open(url, callbackFn)\nOpens a webpage with url and callback function arguments.\n```javascript\nrequire('phantom-proxy').createProxy({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  \n  page.open('http://www.w3.org', function(){\n    console.log('page now open');\n  });  \n  \n});\n```\n##### waitForSelector(selector, callbackFn)\nPolls page for presence of selector, executes callback when selector is present.\n```javascript\nrequire('phantom-proxy').createProxy({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  \n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n    });\n    console.log('page now open');\n  });  \n  \n});\n```\n\n##### render(fileName, callbackFn)\nRenders a image of browser.\n```javascript\nrequire('phantom-proxy').createProxy({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  \n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n      page.render('myimage.png', function(){\n        console.log('saved my picture!');\n      });\n    });\n    console.log('page now open');\n  });  \n  \n});\n```\n##### renderBase64(type, callbackFn)\nReturns a base64 representation of image. \n\n##### evaluate(functionToEvaluate, callbackFn, [arg1, arg2,... argN]\nExecutes functionToEvaluate in phantomJS browser.  Once function executes, callbackFn will be invoked with a result parameter. The Third and sebsequent arguments represent optional parameters which will be passed to the functionToEvaluate function when it is invoked in the browser.\n\n#### Events\n#### Subscribing to events\n```javascript\nphantomProxy = require('phantom-proxy');\nphantomProxy.createProxy({}, function (proxy) {\n    proxy.page.onConsoleMessage = function (event) {\n        console.log(JSON.stringify(event));\n    };\n});\n```\n\n## FAQ\n### Why do we need another nodejs runtime for phantom?\nPhantom-proxy takes a different approach to communicating with phantom than these modules.  Phantom-node passes messages using alerts and express.  While this was an ingenious solution to a difficult problem at the time, better solutions are now available.  As of version 1.4, phantomjs provides an embedded webserver called mongoose which can be used to pass messages.  Phantom-proxy leverages this, which is the fastst and most reliable approach.\n\n\n\n","_id":"phantom-proxy@0.1.9","dist":{"shasum":"0dc50a86f2ed958284dc6776e6369503f62e2594","tarball":"https://registry.npmjs.org/phantom-proxy/-/phantom-proxy-0.1.9.tgz","integrity":"sha512-6q8emnuYqlmNpds/t4wPVGdCFQATI/VzMMaTzesgdhAXXghCsfMDh7mC4cI9r4rnc9HLxvoj23TVl9wp7q/6Fg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHZMlriieZQ+wvZg636rg0tzJlfUtiRhqdxgDnvG8i+hAiAA27gdbWmbrC/QejG2RImeX5XfIoMMt4qzm2gXSENjhQ=="}]},"_npmVersion":"1.1.62","_npmUser":{"name":"sheebz","email":"rob.schieber@gmail.com"},"maintainers":[{"name":"sheebz","email":"rob.schieber@gmail.com"}]},"0.1.10":{"author":{"name":"Rob Schieber","email":"rob.schieber@gmail.com","url":"https://twitter.com/sheebz"},"bugs":{"mail":"rob.schieber@gmail.com","url":" https://github.com/sheebz/phantom-proxy/issues"},"dependencies":{"colors":"~0.6.0-1","form-data":"~0.0.3","mime":"~1.2.7","q":"~0.8.8","underscore":"~1.4.0"},"description":"A set of proxy objects for driving  phantomjs from node","devDependencies":{"cucumber":">0.0.0","mocha":"~1.5.0","should":"~1.2.0"},"directories":{"example":"./example","lib":"./lib","test":"./test"},"engines":{"node":">0.6.0"},"keywords":["phantom","driver","node","phantomjs","phantom-node","node-phantom","feature","test","headless","webkit","cucumber"],"licenses":[{"type":"MIT","url":"https://github.com/sheebz/phantom-proxy/blob/master/README.md"}],"main":"index.js","name":"phantom-proxy","private":false,"repository":{"type":"git","url":"https://github.com/sheebz/phantom-proxy"},"version":"0.1.10","readme":"# phantom-proxy\n* Allows you to drive [phantomjs](www.phantomjs.org) from [node](www.nodejs.org)\n* Does not rely on alert side effects or communicating with phantomjs\n* Uses Phantom's embedded web server for communication\n* Provides a full api - including a parametrized evaluate function - no more hard coded strings\n* Provides additional useful methods such as waitForSelector\n* Can easily integrate with feature testing frameworks such as [cucumber](https://github.com/cucumber/cucumber-js), jasmine, mocha\n\n## Overview\nPhantomJs is an incredibly useful tool for functional and unit testing.  PhantomJs runs in its own process, making it difficult to drive from node.  Phantom-proxy solves this problem, allowing you to fully drive phantomjs from node.\n\n## Installation\n\n`npm install phantom-proxy` \n\n## Usage\n### API\n#### phantomProxy object\n##### create(options, callbackFn)\nuse this method to create an instance of the phantom proxy objects.  The return value will be an object with a page proxy and a phantom proxy.  These properties correspond to the phantom and webpage objects on the native phantom API.  \n\nWhen this method is called, a new phantomjs process is spawned.  The new phantomjs process creates a mongoose webserver on localhost:1061.  All subsequent communication with phantom occurs via http requests. \n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  //do some stuff...\n  //...\n  //call end when done\n  phantomProxy.end();\n});\n```\n\n#### phantom Object\nThe phantom object corresponds to the phantom object in the native phantomJs API.\n\n\n\n#### Page Object\nThe page object corresponds to the webpage object in the native phantomJs API.\n\n##### set(propertyName, propertyValue, callbackFn)\nsets property on page object\n\n```javascript\n  //set viewport size for browser window\n  proxy.page.set('viewportSize', \n  { width:320, height:480 }, function (result) {\n      console.log(result.toString().cyan);\n      worldCallback.call(self);\n  });\n```\n##### open(url, callbackFn)\nOpens a webpage with url and callback function arguments.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  \n  page.open('http://www.w3.org', function(){\n    console.log('page now open');\n    \n    //close proxy\n    phantomProxy.end();\n  });  \n  \n}).end();\n```\n##### waitForSelector(selector, callbackFn)\nPolls page for presence of selector, executes callback when selector is present.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  \n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n      \n        //close proxy\n        phantomProxy.end();\n    });\n    console.log('page now open');\n  });\n  \n}).end();\n```\n\n##### render(fileName, callbackFn)\nRenders a image of browser.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  \n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n      page.render('myimage.png', function(){\n        console.log('saved my picture!');\n        \n        //close proxy\n        phantomProxy.end();\n      });\n    });\n    console.log('page now open');\n  });  \n  \n});\n```\n\n##### renderBase64(type, callbackFn)\nReturns a base64 representation of image. \n\n##### evaluate(functionToEvaluate, callbackFn, [arg1, arg2,... argN]\nExecutes functionToEvaluate in phantomJS browser.  Once function executes, callbackFn will be invoked with a result parameter. The Third and sebsequent arguments represent optional parameters which will be passed to the functionToEvaluate function when it is invoked in the browser.\n\n#### Events\n#### Subscribing to events\n\n```javascript\nphantomProxy = require('phantom-proxy');\nphantomProxy.create({}, function (proxy) {\n    proxy.page.onConsoleMessage = function (event) {\n        console.log(JSON.stringify(event));\n    };\n});\n```\n\n## FAQ\n### Why do we need another nodejs runtime for phantom?\nThe short answer is that phantom-proxy has a better implementation.  Other drivers seem to use a side effect of alerts to communicate with phantomjs, which unfortunately is not a good long term solution. Also all the other libraries I have seen do not have a fully implemented the evaluate function - you can't pass additional arguments to the client side function.  This is a big problem and was the main motivation for creating this package.\n\n","_id":"phantom-proxy@0.1.10","dist":{"shasum":"c18e1308bcb89e169b7e8825055a295c5837b952","tarball":"https://registry.npmjs.org/phantom-proxy/-/phantom-proxy-0.1.10.tgz","integrity":"sha512-UccPL6+FJ5xJ4VAN8drnfPLWTWQXgS0fXBfiPw72HOKWWWt80dVBVeRrp2ZUYeBYvPdXGTNCbWa2BnqfkBpiaw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDdfrvfJ9cFZY/doHD0o1I0p8VjZ2wIBRllH3O2gse7TAiAP4o32aZzdZSYIJnKh976CoNc8Dcrgy3aNUtOu8+YRYA=="}]},"_npmVersion":"1.1.62","_npmUser":{"name":"sheebz","email":"rob.schieber@gmail.com"},"maintainers":[{"name":"sheebz","email":"rob.schieber@gmail.com"}]},"0.1.12":{"author":{"name":"Rob Schieber","email":"rob.schieber@gmail.com","url":"https://twitter.com/sheebz"},"bugs":{"mail":"rob.schieber@gmail.com","url":" https://github.com/sheebz/phantom-proxy/issues"},"dependencies":{"colors":"~0.6.0-1","form-data":"~0.0.3","mime":"~1.2.7","q":"~0.8.8","underscore":"~1.4.0"},"description":"A set of proxy objects for driving  phantomjs from node","devDependencies":{"cucumber":">0.0.0","mocha":"~1.5.0","should":"~1.2.0"},"directories":{"example":"./example","lib":"./lib","test":"./test"},"engines":{"node":">0.6.0"},"keywords":["phantom","driver","node","phantomjs","phantom-node","node-phantom","feature","test","headless","webkit","cucumber"],"licenses":[{"type":"MIT","url":"https://github.com/sheebz/phantom-proxy/blob/master/README.md"}],"main":"index.js","name":"phantom-proxy","private":false,"repository":{"type":"git","url":"https://github.com/sheebz/phantom-proxy"},"version":"0.1.12","readme":"# phantom-proxy\n* Allows you to drive [phantomjs](www.phantomjs.org) from [node](www.nodejs.org)\n* Does not rely on alert side effects for communicating with phantomjs\n* Uses Phantom's embedded mongoose web server for communication - more efficient, simpler, faster.\n* Provides a full api - including a parametrized evaluate function - no more hard coded strings\n* Provides additional useful methods such as waitForSelector\n* Can easily integrate with feature testing frameworks such as [cucumber](https://github.com/cucumber/cucumber-js), jasmine, mocha\n\n## Overview\nPhantomJs is an incredibly useful tool for functional and unit testing.  PhantomJs runs in its own process, making it difficult to drive from node.  Phantom-proxy solves this problem, allowing you to fully drive phantomjs from node.\n\n## Installation\n\n`npm install phantom-proxy` \n\n## Usage\n### API\n#### phantomProxy object\n##### create(options, callbackFn)\nuse this method to create an instance of the phantom proxy objects.  The return value will be an object with a page proxy and a phantom proxy.  These properties correspond to the phantom and webpage objects on the native phantom API.  \n\nWhen this method is called, a new phantomjs process is spawned.  The new phantomjs process creates a mongoose webserver on localhost:1061.  All subsequent communication with phantom occurs via http requests. \n\n##### end()\nIt is important to call end when you are done using the proxy to terminate the underlying phantomjs process that is being driven.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  //do some stuff...\n  //...\n  //call end when done\n  phantomProxy.end();\n});\n```\n\n\n#### phantom Object\nThe phantom object corresponds to the phantom object in the native phantomJs API.\n\n\n#### Page Object\nThe page object corresponds to the webpage object in the native phantomJs API.\n\n##### set(propertyName, propertyValue, callbackFn)\nsets property on page object\n\n```javascript\n  //set viewport size for browser window\n  proxy.page.set('viewportSize', \n  { width:320, height:480 }, function (result) {\n      console.log(result.toString().cyan);\n      worldCallback.call(self);\n  });\n```\n##### open(url, callbackFn)\nOpens a webpage with url and callback function arguments.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  \n  page.open('http://www.w3.org', function(){\n    console.log('page now open');\n    \n    //close proxy\n    phantomProxy.end();\n  });  \n  \n});\n```\n##### waitForSelector(selector, callbackFn)\nPolls page for presence of selector, executes callback when selector is present.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  \n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n      \n        //close proxy\n        phantomProxy.end();\n    });\n    console.log('page now open');\n  });\n  \n});\n```\n\n##### render(fileName, callbackFn)\nRenders a image of browser.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  \n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n      page.render('myimage.png', function(){\n        console.log('saved my picture!');\n        \n        //close proxy\n        phantomProxy.end();\n      });\n    });\n    console.log('page now open');\n  });  \n  \n});\n```\n\n##### renderBase64(type, callbackFn)\nReturns a base64 representation of image. \n\n##### evaluate(functionToEvaluate, callbackFn, [arg1, arg2,... argN]\nExecutes functionToEvaluate in phantomJS browser.  Once function executes, callbackFn will be invoked with a result parameter. The Third and sebsequent arguments represent optional parameters which will be passed to the functionToEvaluate function when it is invoked in the browser.\n\n#### Events\n#### Subscribing to events\n\n```javascript\nphantomProxy = require('phantom-proxy');\nphantomProxy.create({}, function (proxy) {\n    proxy.page.onConsoleMessage = function (event) {\n        console.log(JSON.stringify(event));\n    };\n});\n```\n## More documentation coming...\n\n## FAQ\n### Why do we need another nodejs runtime for phantom?\nThe short answer is that phantom-proxy has a better implementation.  Other drivers seem to use a side effect of alerts to communicate with phantomjs, which unfortunately is not a good long term solution. Also all the other libraries I have seen do not have a fully implemented the evaluate function - you can't pass additional arguments to the client side function.  This is a big problem and was the main motivation for creating this package.\n\n## Revision History\n* version 0.1.10 somewhat stable version released to npm.\n\n","_id":"phantom-proxy@0.1.12","dist":{"shasum":"260a06d478fc30a0c1ee7106a17922a40add0a5e","tarball":"https://registry.npmjs.org/phantom-proxy/-/phantom-proxy-0.1.12.tgz","integrity":"sha512-zQjHjqHLSHNn9P0Qp1PT9a9GXC2RmvydqDUBhzFq8/0KSwJeLojUlF1fuxk/Chjvzk0eOGg99NxT1tQAJZPrXA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEvHl47FdjYAYmU5ibge35iEwOePYbth/6rj7S2PDP5zAiEAq/PU8bElJF0IlPP7M6Oac2vMPCdgkM3GwIEVl8yisjc="}]},"_npmVersion":"1.1.62","_npmUser":{"name":"sheebz","email":"rob.schieber@gmail.com"},"maintainers":[{"name":"sheebz","email":"rob.schieber@gmail.com"}]},"0.1.14":{"author":{"name":"Rob Schieber","email":"rob.schieber@gmail.com","url":"https://twitter.com/sheebz"},"bugs":{"mail":"rob.schieber@gmail.com","url":" https://github.com/sheebz/phantom-proxy/issues"},"dependencies":{"colors":"~0.6.0-1","form-data":"~0.0.3","mime":"~1.2.7","q":"~0.8.8","underscore":"~1.4.0"},"description":"A set of proxy objects for driving  phantomjs from node","devDependencies":{"cucumber":">0.0.0","mocha":"~1.5.0","should":"~1.2.0"},"directories":{"example":"./example","lib":"./lib","test":"./test"},"engines":{"node":">0.6.0"},"keywords":["phantom","driver","node","phantomjs","phantom-node","node-phantom","feature","test","headless","webkit","cucumber"],"licenses":[{"type":"MIT","url":"https://github.com/sheebz/phantom-proxy/blob/master/README.md"}],"main":"index.js","name":"phantom-proxy","private":false,"repository":{"type":"git","url":"https://github.com/sheebz/phantom-proxy"},"version":"0.1.14","readme":"# phantom-proxy\n* Allows you to drive [phantomjs](www.phantomjs.org) from [node](www.nodejs.org)\n* Does not rely on alert side effects for communicating with phantomjs\n* Uses Phantom's embedded mongoose web server for communication - more efficient, simpler, faster.\n* Provides a full api - including a parametrized evaluate function - no more hard coded strings\n* Provides additional useful methods such as waitForSelector\n* Can easily integrate with feature testing frameworks such as [cucumber](https://github.com/cucumber/cucumber-js), jasmine, mocha\n\n## Overview\nPhantomJs is an incredibly useful tool for functional and unit testing.  PhantomJs runs in its own process, making it difficult to drive from node.  Phantom-proxy solves this problem, allowing you to fully drive phantomjs from node.\n\n## Installation\n\n`npm install phantom-proxy` \n\n## Usage\n### API\n#### phantomProxy object\n##### create([options], callbackFn)\nuse this method to create an instance of the phantom proxy objects.  The return value will be an object with a page proxy and a phantom proxy.  These properties correspond to the phantom and webpage objects on the native phantom API.  \n\nWhen this method is called, a new phantomjs process is spawned.  The new phantomjs process creates a mongoose webserver on localhost:1061.  All subsequent communication with phantom occurs via http requests. \n\n###### Options argument (experimental)\nCreate accepts an options object as the first parameter.  This argument is optional.  Properties and their default values are listed below.\n\n```javascript\n        \n        var defaultoptions = {\n            'ignoreSslErrors':true,\n            'localToRemoteUrlAccessEnabled':true,\n            'cookiesFile':'cookies.txt',\n            'diskCache':'yes',\n            'loadImages':'yes',\n            'localToRemoteUrlAccess':'no',\n            'maxDiskCache':'50000',\n            'outputEncoding':'utf8',\n            'proxy':'0',\n            'proxyType':'yes',\n            'scriptEncoding':'yes',\n            'webSecurity':'yes',\n            'port':1061\n        };\n```\n\n##### end()\nIt is important to call end when you are done using the proxy to terminate the underlying phantomjs process that is being driven.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create(function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  //do some stuff...\n  //...\n  //call end when done\n  phantomProxy.end();\n});\n```\n\n#### phantom Object\nThe phantom object corresponds to the phantom object in the native phantomJs API.\n\n#### Page Object\nThe page object corresponds to the webpage object in the native phantomJs API.\n\n##### set(propertyName, propertyValue, callbackFn)\nsets property on page object\n\n```javascript\n  //set viewport size for browser window\n  proxy.page.set('viewportSize', \n  { width:320, height:480 }, function (result) {\n      console.log(result.toString().cyan);\n      worldCallback.call(self);\n  });\n```\n\n##### open(url, callbackFn)\nOpens a webpage with url and callback function arguments.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  \n  page.open('http://www.w3.org', function(){\n    console.log('page now open');\n    \n    //close proxy\n    phantomProxy.end();\n  });  \n  \n});\n```\n\n##### waitForSelector(selector, callbackFn, timeout)\nPolls page for presence of selector, executes callback when selector is present.  \n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  \n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n      \n        //close proxy\n        phantomProxy.end();\n    });\n    console.log('page now open');\n  });\n  \n});\n```\n\n##### render(fileName, callbackFn)\nRenders a image of browser.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  \n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n      page.render('myimage.png', function(){\n        console.log('saved my picture!');\n        \n        //close proxy\n        phantomProxy.end();\n      });\n    });\n    console.log('page now open');\n  });  \n  \n});\n```\n\n##### renderBase64(type, callbackFn)\nReturns a base64 representation of image. \n\n##### evaluate(functionToEvaluate, callbackFn, [arg1, arg2,... argN]\nExecutes functionToEvaluate in phantomJS browser.  Once function executes, callbackFn will be invoked with a result parameter. The Third and sebsequent arguments represent optional parameters which will be passed to the functionToEvaluate function when it is invoked in the browser.\n\n#### Events\n#### Subscribing to events\n\n```javascript\nphantomProxy = require('phantom-proxy');\nphantomProxy.create({}, function (proxy) {\n    proxy.page.onConsoleMessage = function (event) {\n        console.log(JSON.stringify(event));\n    };\n});\n```\n\n## More documentation and features to come...\n\n## FAQ\n### Why do we need another nodejs runtime for phantom?\nThe short answer is that phantom-proxy has a better implementation.  Other drivers seem to use a side effect of alerts to communicate with phantomjs, which unfortunately is not a good long term solution. Also all the other libraries I have seen do not have a fully implemented the evaluate function - you can't pass additional arguments to the client side function.  This is a big problem and was the main motivation for creating this package.\n\n## Revision History\n* version 0.1.13 \n  - added args property handling for phantom object\n  - added ability to specify port for rpc channel \n  - added timeout on waitforSelector function \n  - added ability to pass cmd line arguments for phantom via options object\n* version 0.1.10 \n  - cleaned up and reorganized code\n  - added unit tests\n  - fixed process related issues\n\n","_id":"phantom-proxy@0.1.14","dist":{"shasum":"7191fec9bbe4104642b61989c1cd716ea727cc34","tarball":"https://registry.npmjs.org/phantom-proxy/-/phantom-proxy-0.1.14.tgz","integrity":"sha512-+hxOjAH/oD5nIULTaWFPphyOiJVRVumarhD2CCpcdFP2ChfqqGHrVIPm3Ew45P3XkQ7RN9necPXu9VcejUAxzg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHeXSnsIWy1Xk62CNee1PDjeEhNBdRTc0hZxWg9XH8nfAiA031rXQptwLmDdMsBcJbtcLQFaRAvdAJiWNfB1Du1y0w=="}]},"_npmVersion":"1.1.62","_npmUser":{"name":"sheebz","email":"rob.schieber@gmail.com"},"maintainers":[{"name":"sheebz","email":"rob.schieber@gmail.com"}]},"0.1.15":{"author":{"name":"Rob Schieber","email":"rob.schieber@gmail.com","url":"https://twitter.com/sheebz"},"bugs":{"mail":"rob.schieber@gmail.com","url":" https://github.com/sheebz/phantom-proxy/issues"},"dependencies":{"colors":"~0.6.0-1","form-data":"~0.0.3","mime":"~1.2.7","q":"~0.8.8","underscore":"~1.4.0"},"description":"a lightweight proxy that lets you to drive phantomjs from node.","devDependencies":{"cucumber":">0.0.0","mocha":"~1.5.0","should":"~1.2.0"},"directories":{"example":"./example","lib":"./lib","test":"./test"},"engines":{"node":">0.6.0"},"keywords":["phantom","driver","node","phantomjs","phantom-node","node-phantom","feature","test","headless","webkit","cucumber"],"licenses":[{"type":"MIT","url":"https://github.com/sheebz/phantom-proxy/blob/master/README.md"}],"main":"index.js","name":"phantom-proxy","private":false,"repository":{"type":"git","url":"https://github.com/sheebz/phantom-proxy"},"version":"0.1.15","readme":"# phantom-proxy\n* Allows you to drive [phantomjs](www.phantomjs.org) from [node](www.nodejs.org)\n* Does not rely on alert side effects for communicating with phantomjs\n* Uses Phantom's embedded mongoose web server for communication - more efficient, simpler, faster.\n* Provides a full api - including a parametrized evaluate function - no more hard coded strings\n* Provides additional useful methods such as waitForSelector\n* Can easily integrate with feature testing frameworks such as [cucumber](https://github.com/cucumber/cucumber-js), jasmine, mocha\n\n## Overview\nPhantomJs is an incredibly useful tool for functional and unit testing.  PhantomJs runs in its own process, making it difficult to drive from node.  Phantom-proxy solves this problem, allowing you to fully drive phantomjs from node.\n\n## Installation\n\n`npm install phantom-proxy`\n\n## Usage\n### API\n#### phantomProxy object\n##### create([options], callbackFn)\nuse this method to create an instance of the phantom proxy objects.  The return value will be an object with a page proxy and a phantom proxy.  These properties correspond to the phantom and webpage objects on the native phantom API.\n\nWhen this method is called, a new phantomjs process is spawned.  The new phantomjs process creates a mongoose webserver on localhost:1061.  All subsequent communication with phantom occurs via http requests.\n\n###### Options argument (experimental)\nCreate accepts an options object as the first parameter.  This argument is optional.  Properties and their default values are listed below.\n\n```javascript\n\n        var defaultoptions = {\n            'ignoreSslErrors':true,\n            'localToRemoteUrlAccessEnabled':true,\n            'cookiesFile':'cookies.txt',\n            'diskCache':'yes',\n            'loadImages':'yes',\n            'localToRemoteUrlAccess':'no',\n            'maxDiskCache':'50000',\n            'outputEncoding':'utf8',\n            'proxy':'0',\n            'proxyType':'yes',\n            'scriptEncoding':'yes',\n            'webSecurity':'yes',\n            'port':1061\n        };\n```\n\n##### end()\nIt is important to call end when you are done using the proxy to terminate the underlying phantomjs process that is being driven.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create(function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  //do some stuff...\n  //...\n  //call end when done\n  phantomProxy.end();\n});\n```\n\n#### phantom Object\nThe phantom object corresponds to the phantom object in the native phantomJs API.\n\n#### Page Object\nThe page object corresponds to the webpage object in the native phantomJs API.\n\n##### set(propertyName, propertyValue, callbackFn)\nsets property on page object\n\n```javascript\n  //set viewport size for browser window\n  proxy.page.set('viewportSize',\n  { width:320, height:480 }, function (result) {\n      console.log(result.toString().cyan);\n      worldCallback.call(self);\n  });\n```\n\n##### open(url, callbackFn)\nOpens a webpage with url and callback function arguments.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    console.log('page now open');\n\n    //close proxy\n    phantomProxy.end();\n  });\n\n});\n```\n\n##### waitForSelector(selector, callbackFn, timeout)\nPolls page for presence of selector, executes callback when selector is present.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n\n        //close proxy\n        phantomProxy.end();\n    });\n    console.log('page now open');\n  });\n\n});\n```\n\n##### render(fileName, callbackFn)\nRenders a image of browser.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n      page.render('myimage.png', function(){\n        console.log('saved my picture!');\n\n        //close proxy\n        phantomProxy.end();\n      });\n    });\n    console.log('page now open');\n  });\n\n});\n```\n\n##### renderBase64(type, callbackFn)\nReturns a base64 representation of image.\n\n##### evaluate(functionToEvaluate, callbackFn, [arg1, arg2,... argN]\nExecutes functionToEvaluate in phantomJS browser.  Once function executes, callbackFn will be invoked with a result parameter. The Third and sebsequent arguments represent optional parameters which will be passed to the functionToEvaluate function when it is invoked in the browser.\n\n#### Events\n#### Subscribing to events\n\n```javascript\nphantomProxy = require('phantom-proxy');\nphantomProxy.create({}, function (proxy) {\n    proxy.page.onConsoleMessage = function (event) {\n        console.log(JSON.stringify(event));\n    };\n});\n```\n\n## More documentation and features to come...\n\n## FAQ\n### Why do we need another nodejs runtime for phantom?\nThe short answer is that phantom-proxy has a better implementation.  Other drivers seem to use a side effect of alerts to communicate with phantomjs, which unfortunately is not a good long term solution. Also all the other libraries I have seen do not have a fully implemented the evaluate function - you can't pass additional arguments to the client side function.  This is a big problem and was the main motivation for creating this package.\n\n## Revision History\n* 2012-10-12  - version 0.1.15\n    - fixed a problem w/ waitforSelector fn.\n    - fixed problem where process wasn't shutting down existing server.\n* version 0.1.13\n  - added args property handling for phantom object\n  - added ability to specify port for rpc channel\n  - added timeout on waitforSelector function\n  - added ability to pass cmd line arguments for phantom via options object\n* version 0.1.10\n  - cleaned up and reorganized code\n  - added unit tests\n  - fixed process related issues\n\n","_id":"phantom-proxy@0.1.15","dist":{"shasum":"9598b4856873564d50a45dc226adb4891e3f2ffb","tarball":"https://registry.npmjs.org/phantom-proxy/-/phantom-proxy-0.1.15.tgz","integrity":"sha512-PVR+yxn/xvHroGLMMLCSlOlVEjaNCB7wWHeZxvgYIfM7XkJcMwDJ+YcvarrbQuYzx+YQ31hEYuNXh7bWmIFqzw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCo54Hjaz7cysh3T7W1BFze2ATw0Jcs35sg0r9vaIlnQQIhAI8qwL1P3Zv8U8F3smZSnujWrHYjLQbaSGAoL3AXiTRY"}]},"_npmVersion":"1.1.62","_npmUser":{"name":"sheebz","email":"rob.schieber@gmail.com"},"maintainers":[{"name":"sheebz","email":"rob.schieber@gmail.com"}]},"0.1.16":{"author":{"name":"Rob Schieber","email":"rob.schieber@gmail.com","url":"https://twitter.com/sheebz"},"bugs":{"mail":"rob.schieber@gmail.com","url":" https://github.com/sheebz/phantom-proxy/issues"},"dependencies":{"colors":"~0.6.0-1","form-data":"~0.0.3","mime":"~1.2.7","q":"~0.8.8","underscore":"~1.4.0"},"description":"a lightweight proxy that lets you to drive phantomjs from node.","devDependencies":{"cucumber":">0.0.0","mocha":"~1.5.0","should":"~1.2.0"},"directories":{"example":"./example","lib":"./lib","test":"./test"},"engines":{"node":">0.6.0"},"keywords":["phantom","driver","node","phantomjs","phantom-node","node-phantom","feature","test","headless","webkit","cucumber"],"licenses":[{"type":"MIT","url":"https://github.com/sheebz/phantom-proxy/blob/master/README.md"}],"main":"index.js","name":"phantom-proxy","private":false,"repository":{"type":"git","url":"https://github.com/sheebz/phantom-proxy"},"version":"0.1.16","readme":"# phantom-proxy\n* Allows you to drive [phantomjs](www.phantomjs.org) from [node](www.nodejs.org)\n* Does not rely on alert side effects for communicating with phantomjs\n* Uses Phantom's embedded mongoose web server for communication - more efficient, simpler, faster.\n* Provides a full api - including a parametrized evaluate function - no more hard coded strings\n* Provides additional useful methods such as waitForSelector\n* Can easily integrate with feature testing frameworks such as [cucumber](https://github.com/cucumber/cucumber-js), jasmine, mocha\n\n## Overview\nPhantomJs is an incredibly useful tool for functional and unit testing.  PhantomJs runs in its own process, making it difficult to drive from node.  Phantom-proxy solves this problem, allowing you to fully drive phantomjs from node.\n\n## Installation\n\n`npm install phantom-proxy`\n\n## Usage\n### API\n#### phantomProxy object\n##### create([options], callbackFn)\nuse this method to create an instance of the phantom proxy objects.  The return value will be an object with a page proxy and a phantom proxy.  These properties correspond to the phantom and webpage objects on the native phantom API.\n\nWhen this method is called, a new phantomjs process is spawned.  The new phantomjs process creates a mongoose webserver on localhost:1061.  All subsequent communication with phantom occurs via http requests.\n\n###### Options argument (experimental)\nCreate accepts an options object as the first parameter.  This argument is optional.  Properties and their default values are listed below.\n\n```javascript\n\n        var defaultoptions = {\n            'ignoreSslErrors':true,\n            'localToRemoteUrlAccessEnabled':true,\n            'cookiesFile':'cookies.txt',\n            'diskCache':'yes',\n            'loadImages':'yes',\n            'localToRemoteUrlAccess':'no',\n            'maxDiskCache':'50000',\n            'outputEncoding':'utf8',\n            'proxy':'0',\n            'proxyType':'yes',\n            'scriptEncoding':'yes',\n            'webSecurity':'yes',\n            'port':1061\n        };\n```\n\n##### end()\nIt is important to call end when you are done using the proxy to terminate the underlying phantomjs process that is being driven.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create(function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  //do some stuff...\n  //...\n  //call end when done\n  phantomProxy.end();\n});\n```\n\n#### phantom Object\nThe phantom object corresponds to the phantom object in the native phantomJs API.\n\n#### Page Object\nThe page object corresponds to the webpage object in the native phantomJs API.\n\n##### set(propertyName, propertyValue, callbackFn)\nsets property on page object\n\n```javascript\n  //set viewport size for browser window\n  proxy.page.set('viewportSize',\n  { width:320, height:480 }, function (result) {\n      console.log(result.toString().cyan);\n      worldCallback.call(self);\n  });\n```\n\n##### open(url, callbackFn)\nOpens a webpage with url and callback function arguments.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    console.log('page now open');\n\n    //close proxy\n    phantomProxy.end();\n  });\n\n});\n```\n\n##### waitForSelector(selector, callbackFn, timeout)\nPolls page for presence of selector, executes callback when selector is present.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n\n        //close proxy\n        phantomProxy.end();\n    });\n    console.log('page now open');\n  });\n\n});\n```\n\n##### render(fileName, callbackFn)\nRenders a image of browser.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n      page.render('myimage.png', function(){\n        console.log('saved my picture!');\n\n        //close proxy\n        phantomProxy.end();\n      });\n    });\n    console.log('page now open');\n  });\n\n});\n```\n\n##### renderBase64(type, callbackFn)\nReturns a base64 representation of image.\n\n##### evaluate(functionToEvaluate, callbackFn, [arg1, arg2,... argN]\nExecutes functionToEvaluate in phantomJS browser.  Once function executes, callbackFn will be invoked with a result parameter. The Third and sebsequent arguments represent optional parameters which will be passed to the functionToEvaluate function when it is invoked in the browser.\n\n#### Events\n#### Subscribing to events\n\n```javascript\nphantomProxy = require('phantom-proxy');\nphantomProxy.create({}, function (proxy) {\n    proxy.page.onConsoleMessage = function (event) {\n        console.log(JSON.stringify(event));\n    };\n});\n```\n\n## More documentation and features to come...\n\n## FAQ\n### Why do we need another nodejs runtime for phantom?\nThe short answer is that phantom-proxy has a better implementation.  Other drivers seem to use a side effect of alerts to communicate with phantomjs, which unfortunately is not a good long term solution. Also all the other libraries I have seen do not have a fully implemented the evaluate function - you can't pass additional arguments to the client side function.  This is a big problem and was the main motivation for creating this package.\n\n## Revision History\n* 2012-10-17 - version 0.1.16\n   - fixed waitforSelector issue\n* 2012-10-12  - version 0.1.15\n    - fixed a problem w/ waitforSelector fn.\n    - fixed problem where process wasn't shutting down existing server.\n* version 0.1.13\n  - added args property handling for phantom object\n  - added ability to specify port for rpc channel\n  - added timeout on waitforSelector function\n  - added ability to pass cmd line arguments for phantom via options object\n* version 0.1.10\n  - cleaned up and reorganized code\n  - added unit tests\n  - fixed process related issues\n\n","_id":"phantom-proxy@0.1.16","dist":{"shasum":"56fefcc3fb22cf0eff2eaafd239efc47736eff82","tarball":"https://registry.npmjs.org/phantom-proxy/-/phantom-proxy-0.1.16.tgz","integrity":"sha512-wmNkkVEwsaE8+ZfjsRvOp4XZ2BCZhqm+ACe4h0T9VWwuBiZlZ1jcWw1CiSSWUXZK/tz0pspJsxBHvzdHZsBe+A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDdTULoI7iyCMnLAr9UcN7JYq2/3vmwJckCD2MqrZ1vBgIgF2gaYpcwS7LqhO51bIAUn0B+2fNg74HnnnTfo/ShPas="}]},"_npmVersion":"1.1.62","_npmUser":{"name":"sheebz","email":"rob.schieber@gmail.com"},"maintainers":[{"name":"sheebz","email":"rob.schieber@gmail.com"}]},"0.1.17":{"author":{"name":"Rob Schieber","email":"rob.schieber@gmail.com","url":"https://twitter.com/sheebz"},"bugs":{"mail":"rob.schieber@gmail.com","url":" https://github.com/sheebz/phantom-proxy/issues"},"dependencies":{"colors":"~0.6.0-1","form-data":"~0.0.3","mime":"~1.2.7","q":"~0.8.8","underscore":"~1.4.0"},"description":"a lightweight proxy that lets you to drive phantomjs from node.","devDependencies":{"cucumber":">0.0.0","mocha":"~1.5.0","should":"~1.2.0"},"directories":{"example":"./example","lib":"./lib","test":"./test"},"engines":{"node":">0.6.0"},"keywords":["phantom","driver","node","phantomjs","phantom-node","node-phantom","feature","test","headless","webkit","cucumber"],"licenses":[{"type":"MIT","url":"https://github.com/sheebz/phantom-proxy/blob/master/README.md"}],"main":"index.js","name":"phantom-proxy","private":false,"repository":{"type":"git","url":"https://github.com/sheebz/phantom-proxy"},"version":"0.1.17","readme":"# phantom-proxy\n* Allows you to drive [phantomjs](www.phantomjs.org) from [node](www.nodejs.org)\n* Does not rely on alert side effects for communicating with phantomjs\n* Uses Phantom's embedded mongoose web server for communication - more efficient, simpler, faster.\n* Provides a full api - including a parametrized evaluate function - no more hard coded strings\n* Provides additional useful methods such as waitForSelector\n* Can easily integrate with feature testing frameworks such as [cucumber](https://github.com/cucumber/cucumber-js), jasmine, mocha\n\n## Overview\nPhantomJs is an incredibly useful tool for functional and unit testing.  PhantomJs runs in its own process, making it difficult to drive from node.  Phantom-proxy solves this problem, allowing you to fully drive phantomjs from node.\n\n## Installation\n\n`npm install phantom-proxy`\n\n## Usage\n### Examples\n```javascript\nvar phantomProxy = require(phantom-proxy);\n\nphantomProxy.create({}, function (proxy) {\n    var page = proxy.page;\n    page.open('http://www.w3.org', function () {\n        page.waitForSelector('body', function () {\n            console.log('body tag present');\n            phantomProxy.end();\n        });\n    });\n\n});\n```\n\n### API\n#### phantomProxy object\n##### create([options], callbackFn)\nuse this method to create an instance of the phantom proxy objects.  The return value will be an object with a page proxy and a phantom proxy.  These properties correspond to the phantom and webpage objects on the native phantom API.\n\nWhen this method is called, a new phantomjs process is spawned.  The new phantomjs process creates a mongoose webserver on localhost:1061.  All subsequent communication with phantom occurs via http requests.\n\n###### Options argument (experimental)\nCreate accepts an options object as the first parameter.  This argument is optional.  Properties and their default values are listed below.\n\n```javascript\n\n        var defaultoptions = {\n            'ignoreSslErrors':true,\n            'localToRemoteUrlAccessEnabled':true,\n            'cookiesFile':'cookies.txt',\n            'diskCache':'yes',\n            'loadImages':'yes',\n            'localToRemoteUrlAccess':'no',\n            'maxDiskCache':'50000',\n            'outputEncoding':'utf8',\n            'proxy':'0',\n            'proxyType':'yes',\n            'scriptEncoding':'yes',\n            'webSecurity':'yes',\n            'port':1061\n        };\n```\n\n##### end()\nIt is important to call end when you are done using the proxy to terminate the underlying phantomjs process that is being driven.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create(function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  //do some stuff...\n  //...\n  //call end when done\n  phantomProxy.end();\n});\n```\n\n#### phantom Object\nThe phantom object corresponds to the phantom object in the native phantomJs API.\n\n#### Page Object\nThe page object corresponds to the webpage object in the native phantomJs API.\n\n##### set(propertyName, propertyValue, callbackFn)\nsets property on page object\n\n```javascript\n  //set viewport size for browser window\n  proxy.page.set('viewportSize',\n  { width:320, height:480 }, function (result) {\n      console.log(result.toString().cyan);\n      worldCallback.call(self);\n  });\n```\n\n##### open(url, callbackFn)\nOpens a webpage with url and callback function arguments.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    console.log('page now open');\n\n    //close proxy\n    phantomProxy.end();\n  });\n\n});\n```\n\n##### waitForSelector(selector, callbackFn, timeout)\nPolls page for presence of selector, executes callback when selector is present.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n\n        //close proxy\n        phantomProxy.end();\n    });\n    console.log('page now open');\n  });\n\n});\n```\n\n##### render(fileName, callbackFn)\nRenders a image of browser.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n      page.render('myimage.png', function(){\n        console.log('saved my picture!');\n\n        //close proxy\n        phantomProxy.end();\n      });\n    });\n    console.log('page now open');\n  });\n\n});\n```\n\n##### renderBase64(type, callbackFn)\nReturns a base64 representation of image.\n\n##### evaluate(functionToEvaluate, callbackFn, [arg1, arg2,... argN]\nExecutes functionToEvaluate in phantomJS browser.  Once function executes, callbackFn will be invoked with a result parameter. The Third and sebsequent arguments represent optional parameters which will be passed to the functionToEvaluate function when it is invoked in the browser.\n\n#### Events\n#### Subscribing to events\n\n```javascript\nphantomProxy = require('phantom-proxy');\nphantomProxy.create({}, function (proxy) {\n    proxy.page.onConsoleMessage = function (event) {\n        console.log(JSON.stringify(event));\n    };\n});\n```\n\n## More documentation and features to come...\n\n## FAQ\n### Why do we need another nodejs runtime for phantom?\nThe short answer is that phantom-proxy has a better implementation.  Other drivers seem to use a side effect of alerts to communicate with phantomjs, which unfortunately is not a good long term solution. Also all the other libraries I have seen do not have a fully implemented the evaluate function - you can't pass additional arguments to the client side function.  This is a big problem and was the main motivation for creating this package.\n\n## Revision History\n* 2012-10-17 - version 0.1.16\n   - fixed waitforSelector issue\n* 2012-10-12  - version 0.1.15\n    - fixed a problem w/ waitforSelector fn.\n    - fixed problem where process wasn't shutting down existing server.\n* version 0.1.13\n  - added args property handling for phantom object\n  - added ability to specify port for rpc channel\n  - added timeout on waitforSelector function\n  - added ability to pass cmd line arguments for phantom via options object\n* version 0.1.10\n  - cleaned up and reorganized code\n  - added unit tests\n  - fixed process related issues\n\n","_id":"phantom-proxy@0.1.17","dist":{"shasum":"0f508bd575a3788baf16b6793a8d22463fa5ff85","tarball":"https://registry.npmjs.org/phantom-proxy/-/phantom-proxy-0.1.17.tgz","integrity":"sha512-AmT4pVCCAfP6iFnSCvIaH0YS8xJTOU4sS9pIib7b1W6n7ADkw32OacdKlLZwLsAM/mkwXfRQA+zUcp2rkJktYw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDalm4gWz831eAg3Jecb89kcnIziarkO54s3c2p6H7SPQIgLez2XhjW882sWx2Rshebsi95mgsLdYQdL89euQx7Oqw="}]},"_npmVersion":"1.1.62","_npmUser":{"name":"sheebz","email":"rob.schieber@gmail.com"},"maintainers":[{"name":"sheebz","email":"rob.schieber@gmail.com"}]},"0.1.18":{"author":{"name":"Rob Schieber","email":"rob.schieber@gmail.com","url":"https://twitter.com/sheebz"},"bugs":{"mail":"rob.schieber@gmail.com","url":" https://github.com/sheebz/phantom-proxy/issues"},"dependencies":{"colors":"~0.6.0-1","form-data":"~0.0.3","mime":"~1.2.7","q":"~0.8.8","underscore":"~1.4.0"},"description":"a lightweight proxy that lets you to drive phantomjs from node.","devDependencies":{"cucumber":">0.0.0","mocha":"~1.5.0","should":"~1.2.0"},"directories":{"example":"./example","lib":"./lib","test":"./test"},"engines":{"node":">0.6.0"},"keywords":["phantom","driver","node","phantomjs","phantom-node","node-phantom","feature","test","headless","webkit","cucumber"],"licenses":[{"type":"MIT","url":"https://github.com/sheebz/phantom-proxy/blob/master/README.md"}],"main":"index.js","name":"phantom-proxy","private":false,"repository":{"type":"git","url":"https://github.com/sheebz/phantom-proxy"},"version":"0.1.18","readme":"# phantom-proxy\n* Allows you to drive [phantomjs](www.phantomjs.org) from [node](www.nodejs.org)\n* Does not rely on alert side effects for communicating with phantomjs\n* Uses Phantom's embedded mongoose web server for communication - more efficient, simpler, faster.\n* Provides a full api - including a parametrized evaluate function - no more hard coded strings\n* Provides additional useful methods such as waitForSelector\n* Can easily integrate with feature testing frameworks such as [cucumber](https://github.com/cucumber/cucumber-js), jasmine, mocha\n\n## Overview\nPhantomJs is an incredibly useful tool for functional and unit testing.  PhantomJs runs in its own process, making it difficult to drive from node.  Phantom-proxy solves this problem, allowing you to fully drive phantomjs from node.\n\n## Installation\n\n`npm install phantom-proxy`\n\n## Usage\n### Examples\n```javascript\nvar phantomProxy = require('phantom-proxy');\n\nphantomProxy.create({}, function (proxy) {\n    var page = proxy.page;\n    page.open('http://www.w3.org', function () {\n        page.waitForSelector('body', function () {\n            console.log('body tag present');\n            phantomProxy.end();\n        });\n    });\n\n});\n```\n\n### API\n#### phantomProxy object\n##### create([options], callbackFn)\nuse this method to create an instance of the phantom proxy objects.  The return value will be an object with a page proxy and a phantom proxy.  These properties correspond to the phantom and webpage objects on the native phantom API.\n\nWhen this method is called, a new phantomjs process is spawned.  The new phantomjs process creates a mongoose webserver on localhost:1061.  All subsequent communication with phantom occurs via http requests.\n\n###### Options argument (experimental)\nCreate accepts an options object as the first parameter.  This argument is optional.  Properties and their default values are listed below.\n\n```javascript\n\n        var defaultoptions = {\n            'ignoreSslErrors':true,\n            'localToRemoteUrlAccessEnabled':true,\n            'cookiesFile':'cookies.txt',\n            'diskCache':'yes',\n            'loadImages':'yes',\n            'localToRemoteUrlAccess':'no',\n            'maxDiskCache':'50000',\n            'outputEncoding':'utf8',\n            'proxy':'0',\n            'proxyType':'yes',\n            'scriptEncoding':'yes',\n            'webSecurity':'yes',\n            'port':1061\n        };\n```\n\n##### end()\nIt is important to call end when you are done using the proxy to terminate the underlying phantomjs process that is being driven.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create(function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  //do some stuff...\n  //...\n  //call end when done\n  phantomProxy.end();\n});\n```\n\n#### phantom Object\nThe phantom object corresponds to the phantom object in the native phantomJs API.\n\n#### Page Object\nThe page object corresponds to the webpage object in the native phantomJs API.\n\n##### set(propertyName, propertyValue, callbackFn)\nsets property on page object\n\n```javascript\n  //set viewport size for browser window\n  proxy.page.set('viewportSize',\n  { width:320, height:480 }, function (result) {\n      console.log(result.toString().cyan);\n      worldCallback.call(self);\n  });\n```\n\n##### open(url, callbackFn)\nOpens a webpage with url and callback function arguments.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    console.log('page now open');\n\n    //close proxy\n    phantomProxy.end();\n  });\n\n});\n```\n\n##### waitForSelector(selector, callbackFn, timeout)\nPolls page for presence of selector, executes callback when selector is present.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n\n        //close proxy\n        phantomProxy.end();\n    });\n    console.log('page now open');\n  });\n\n});\n```\n\n##### render(fileName, callbackFn)\nRenders a image of browser.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n      page.render('myimage.png', function(){\n        console.log('saved my picture!');\n\n        //close proxy\n        phantomProxy.end();\n      });\n    });\n    console.log('page now open');\n  });\n\n});\n```\n\n##### renderBase64(type, callbackFn)\nReturns a base64 representation of image.\n\n##### evaluate(functionToEvaluate, callbackFn, [arg1, arg2,... argN]\nExecutes functionToEvaluate in phantomJS browser.  Once function executes, callbackFn will be invoked with a result parameter. The Third and sebsequent arguments represent optional parameters which will be passed to the functionToEvaluate function when it is invoked in the browser.\n\n#### Events\n#### Subscribing to events\n\n```javascript\nphantomProxy = require('phantom-proxy');\nphantomProxy.create({}, function (proxy) {\n    proxy.page.onConsoleMessage = function (event) {\n        console.log(JSON.stringify(event));\n    };\n});\n```\n\n## More documentation and features to come...\n\n## FAQ\n### Why do we need another nodejs runtime for phantom?\nThe short answer is that phantom-proxy has a better implementation.  Other drivers seem to use a side effect of alerts to communicate with phantomjs, which unfortunately is not a good long term solution. Also all the other libraries I have seen do not have a fully implemented the evaluate function - you can't pass additional arguments to the client side function.  This is a big problem and was the main motivation for creating this package.\n\n## Revision History\n* 2012-10-17 - version 0.1.16\n   - fixed waitforSelector issue\n* 2012-10-12  - version 0.1.15\n    - fixed a problem w/ waitforSelector fn.\n    - fixed problem where process wasn't shutting down existing server.\n* version 0.1.13\n  - added args property handling for phantom object\n  - added ability to specify port for rpc channel\n  - added timeout on waitforSelector function\n  - added ability to pass cmd line arguments for phantom via options object\n* version 0.1.10\n  - cleaned up and reorganized code\n  - added unit tests\n  - fixed process related issues\n\n","_id":"phantom-proxy@0.1.18","dist":{"shasum":"098cf6f97e91823ba17ed46e0ce0ff46a4bf73d8","tarball":"https://registry.npmjs.org/phantom-proxy/-/phantom-proxy-0.1.18.tgz","integrity":"sha512-Ugt/IxO4M4DSjUvtLKExjp6B/XB7bF8ytN6lISYXpm+uv5fRPN2RjZ6KfQ5BURDbkupuREYkJSJppgPwYxNXRw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCZyMimASPBCew4zP2F9C1+mkyVVPvcda/PdQLmx+IbtwIgR3Yg6+Yy0zzdYKHqjraiWpgxYC3c6JaANoZqxWgf3i4="}]},"_npmVersion":"1.1.62","_npmUser":{"name":"sheebz","email":"rob.schieber@gmail.com"},"maintainers":[{"name":"sheebz","email":"rob.schieber@gmail.com"}]},"0.1.19":{"author":{"name":"Rob Schieber","email":"rob.schieber@gmail.com","url":"https://twitter.com/sheebz"},"bugs":{"mail":"rob.schieber@gmail.com","url":" https://github.com/sheebz/phantom-proxy/issues"},"dependencies":{"colors":"~0.6.0-1","form-data":"~0.0.3","mime":"~1.2.7","q":"~0.8.8","underscore":"~1.4.0"},"description":"a lightweight proxy that lets you to drive phantomjs from node.","devDependencies":{"cucumber":">0.0.0","mocha":"~1.5.0","should":"~1.2.0"},"directories":{"example":"./example","lib":"./lib","test":"./test"},"engines":{"node":">0.6.0"},"keywords":["phantom","driver","node","phantomjs","phantom-node","node-phantom","feature","test","headless","webkit","cucumber"],"licenses":[{"type":"MIT","url":"https://github.com/sheebz/phantom-proxy/blob/master/README.md"}],"main":"index.js","name":"phantom-proxy","private":false,"repository":{"type":"git","url":"https://github.com/sheebz/phantom-proxy"},"version":"0.1.19","readme":"# phantom-proxy\n* Allows you to drive [phantomjs](www.phantomjs.org) from [node](www.nodejs.org)\n* Does not rely on alert side effects for communicating with phantomjs\n* Uses Phantom's embedded mongoose web server for communication - more efficient, simpler, faster.\n* Provides a full api - including a parametrized evaluate function - no more hard coded strings\n* Provides additional useful methods such as waitForSelector\n* Can easily integrate with feature testing frameworks such as [cucumber](https://github.com/cucumber/cucumber-js), jasmine, mocha\n\n## Overview\nPhantomJs is an incredibly useful tool for functional and unit testing.  PhantomJs runs in its own process, making it difficult to drive from node.  Phantom-proxy solves this problem, allowing you to fully drive phantomjs from node.\n\n## Installation\n\n`npm install phantom-proxy`\n\n## Usage\n### Examples\n```javascript\nvar phantomProxy = require('phantom-proxy');\n\nphantomProxy.create({}, function (proxy) {\n    var page = proxy.page;\n    page.open('http://www.w3.org', function () {\n        page.waitForSelector('body', function () {\n            console.log('body tag present');\n            phantomProxy.end();\n        });\n    });\n\n});\n```\n\n### API\n#### phantomProxy object\n##### create([options], callbackFn)\nuse this method to create an instance of the phantom proxy objects.  The return value will be an object with a page proxy and a phantom proxy.  These properties correspond to the phantom and webpage objects on the native phantom API.\n\nWhen this method is called, a new phantomjs process is spawned.  The new phantomjs process creates a mongoose webserver on localhost:1061.  All subsequent communication with phantom occurs via http requests.\n\n###### Options argument (experimental)\nCreate accepts an options object as the first parameter.  This argument is optional.  Properties and their default values are listed below.\n\n```javascript\n\n        var defaultoptions = {\n            'ignoreSslErrors':true,\n            'localToRemoteUrlAccessEnabled':true,\n            'cookiesFile':'cookies.txt',\n            'diskCache':'yes',\n            'loadImages':'yes',\n            'localToRemoteUrlAccess':'no',\n            'maxDiskCache':'50000',\n            'outputEncoding':'utf8',\n            'proxy':'0',\n            'proxyType':'yes',\n            'scriptEncoding':'yes',\n            'webSecurity':'yes',\n            'port':1061\n        };\n```\n\n##### end()\nIt is important to call end when you are done using the proxy to terminate the underlying phantomjs process that is being driven.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create(function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  //do some stuff...\n  //...\n  //call end when done\n  phantomProxy.end();\n});\n```\n\n#### phantom Object\nThe phantom object corresponds to the phantom object in the native phantomJs API.\n\n#### Page Object\nThe page object corresponds to the webpage object in the native phantomJs API.\n\n##### set(propertyName, propertyValue, callbackFn)\nsets property on page object\n\n```javascript\n  //set viewport size for browser window\n  proxy.page.set('viewportSize',\n  { width:320, height:480 }, function (result) {\n      console.log(result.toString().cyan);\n      worldCallback.call(self);\n  });\n```\n\n##### open(url, callbackFn)\nOpens a webpage with url and callback function arguments.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    console.log('page now open');\n\n    //close proxy\n    phantomProxy.end();\n  });\n\n});\n```\n\n##### waitForSelector(selector, callbackFn, timeout)\nPolls page for presence of selector, executes callback when selector is present.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n\n        //close proxy\n        phantomProxy.end();\n    });\n    console.log('page now open');\n  });\n\n});\n```\n\n##### render(fileName, callbackFn)\nRenders a image of browser.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n      page.render('myimage.png', function(){\n        console.log('saved my picture!');\n\n        //close proxy\n        phantomProxy.end();\n      });\n    });\n    console.log('page now open');\n  });\n\n});\n```\n\n##### renderBase64(type, callbackFn)\nReturns a base64 representation of image.\n\n##### evaluate(functionToEvaluate, callbackFn, [arg1, arg2,... argN]\nExecutes functionToEvaluate in phantomJS browser.  Once function executes, callbackFn will be invoked with a result parameter. The Third and sebsequent arguments represent optional parameters which will be passed to the functionToEvaluate function when it is invoked in the browser.\n\n#### Events\n#### Subscribing to events\n\n```javascript\nphantomProxy = require('phantom-proxy');\nphantomProxy.create({}, function (proxy) {\n    proxy.page.onConsoleMessage = function (event) {\n        console.log(JSON.stringify(event));\n    };\n});\n```\n\n## More documentation and features to come...\n\n## FAQ\n### Why do we need another nodejs runtime for phantom?\nThe short answer is that phantom-proxy has a better implementation.  Other drivers seem to use a side effect of alerts to communicate with phantomjs, which unfortunately is not a good long term solution. Also all the other libraries I have seen do not have a fully implemented the evaluate function - you can't pass additional arguments to the client side function.  This is a big problem and was the main motivation for creating this package.\n\n## Revision History\n* 2012-10-17 - version 0.1.16\n   - fixed waitforSelector issue\n* 2012-10-12  - version 0.1.15\n    - fixed a problem w/ waitforSelector fn.\n    - fixed problem where process wasn't shutting down existing server.\n* version 0.1.13\n  - added args property handling for phantom object\n  - added ability to specify port for rpc channel\n  - added timeout on waitforSelector function\n  - added ability to pass cmd line arguments for phantom via options object\n* version 0.1.10\n  - cleaned up and reorganized code\n  - added unit tests\n  - fixed process related issues\n\n","_id":"phantom-proxy@0.1.19","dist":{"shasum":"e886111cf8df71bba7d570865f3bfc483d98ffe3","tarball":"https://registry.npmjs.org/phantom-proxy/-/phantom-proxy-0.1.19.tgz","integrity":"sha512-7Miyt/KGy61AGPDrJLstqb5Loa7sUtLLpqxVqvyVBzuwu5EjOmWjRSRyrfN4D37px7oTxtz2/UmCQCl+MB/PQw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHUZenMaHBNQ6syGeSIKQ/3SoMDcKjTX6oTMGDyX2rQiAiAz3v8SvxrlAqdfHco+qYoa7Pkb101HqQS8WyWkxv6n9w=="}]},"_npmVersion":"1.1.62","_npmUser":{"name":"sheebz","email":"rob.schieber@gmail.com"},"maintainers":[{"name":"sheebz","email":"rob.schieber@gmail.com"}]},"0.1.2":{"author":{"name":"Rob Schieber","email":"rob.schieber@gmail.com","url":"https://twitter.com/sheebz"},"bugs":{"mail":"rob.schieber@gmail.com","url":" https://github.com/sheebz/phantom-proxy/issues"},"dependencies":{"colors":"~0.6.0-1","form-data":"~0.0.3","mime":"~1.2.7","q":"~0.8.8","underscore":"~1.4.0"},"description":"a lightweight proxy that lets you to drive phantomjs from node.","devDependencies":{"cucumber":">0.0.0","mocha":"~1.5.0","should":"~1.2.0","jshint":"latest"},"directories":{"example":"./example","lib":"./lib","test":"./test"},"engines":{"node":">0.6.0"},"keywords":["phantom","driver","node","phantomjs","BDD","automated","testing","DOM","JSDOM","zombie","zombiejs","phantom-node","node-phantom","feature","test","headless","webkit","cucumber"],"licenses":[{"type":"MIT","url":"https://github.com/sheebz/phantom-proxy/blob/master/README.md"}],"main":"index.js","name":"phantom-proxy","private":false,"repository":{"type":"git","url":"https://github.com/sheebz/phantom-proxy"},"version":"0.1.2","readme":"# phantom-proxy\n* Allows you to drive [phantomjs](www.phantomjs.org) from [node](www.nodejs.org)\n* Does not rely on alert side effects for communicating with phantomjs\n* Uses Phantom's embedded mongoose web server for communication - more efficient, simpler, faster.\n* Provides a full api - including a parametrized evaluate function - no more hard coded strings\n* Provides additional useful methods such as waitForSelector\n* Can easily integrate with feature testing frameworks such as [cucumber](https://github.com/cucumber/cucumber-js), jasmine, mocha\n\n## Overview\nPhantomJs is an incredibly useful tool for functional and unit testing.  PhantomJs runs in its own process, making it difficult to drive from node.  Phantom-proxy solves this problem, allowing you to fully drive phantomjs from node.\n\n## Installation\n\n`npm install phantom-proxy`\n\n## Usage\n### Examples\n```javascript\nvar phantomProxy = require('phantom-proxy');\n\nphantomProxy.create({}, function (proxy) {\n    var page = proxy.page;\n    page.open('http://www.w3.org', function () {\n        page.waitForSelector('body', function () {\n            console.log('body tag present');\n            phantomProxy.end();\n        });\n    });\n\n});\n```\n\nSee the [API](https://github.com/sheebz/phantom-proxy/blob/master/api.md) documentation for more usage information.\n\n## FAQ\n### Why do we need another nodejs runtime for phantom?\nThe short answer is that phantom-proxy has a better implementation.  Other drivers seem to use a side effect of alerts to communicate with phantomjs, which unfortunately is not a good long term solution. Also all the other libraries I have seen do not have a fully implemented the evaluate function - you can't pass additional arguments to the client side function.  This is a big problem and was the main motivation for creating this package.\n\n## Revision History\n* 2012-10-22 - version 0.1.2\n  - breaking - changed the way events are consumed, switched to using nodes emmitter to brodcast events as opposed to invoking instance methods on the object.  To fix issues, use [object].on('eventname') style syntax.\n  - Code clean up\n* 2012-10-17 - version 0.1.16\n   - fixed waitforSelector issue\n* 2012-10-12  - version 0.1.15\n    - fixed a problem w/ waitforSelector fn.\n    - fixed problem where process wasn't shutting down existing server.\n* version 0.1.13\n  - added args property handling for phantom object\n  - added ability to specify port for rpc channel\n  - added timeout on waitforSelector function\n  - added ability to pass cmd line arguments for phantom via options object\n* version 0.1.10\n  - cleaned up and reorganized code\n  - added unit tests\n  - fixed process related issues\n\n","_id":"phantom-proxy@0.1.2","dist":{"shasum":"97677411d963be91663cbfc78b654844e80e5db3","tarball":"https://registry.npmjs.org/phantom-proxy/-/phantom-proxy-0.1.2.tgz","integrity":"sha512-g9/66t84/xvy1wUbBDKqFG73rn6/XzgoQu0Fw2wnGTaYC427TIXvvZfIIMKjeqIQvQceGaINxIIJTrVPJcUgNw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBl6d8GwOOWHD607e2+vjUuN6dBs7ysek/QMzhvVu5/SAiBhPC2CgVdnlTVKgfys4qf1enca0DZmXB8jAmr97pfpLw=="}]},"_npmVersion":"1.1.62","_npmUser":{"name":"sheebz","email":"rob.schieber@gmail.com"},"maintainers":[{"name":"sheebz","email":"rob.schieber@gmail.com"}]},"0.1.51":{"author":{"name":"Rob Schieber","email":"rob.schieber@gmail.com","url":"https://twitter.com/sheebz"},"bugs":{"mail":"rob.schieber@gmail.com","url":" https://github.com/sheebz/phantom-proxy/issues"},"dependencies":{"colors":"~0.6.0-1","form-data":"~0.0.3","mime":"~1.2.7","q":"~0.8.8","underscore":"~1.4.0"},"description":"a lightweight proxy that lets you to drive phantomjs from node.","devDependencies":{"cucumber":">0.0.0","mocha":"~1.5.0","should":"~1.2.0","jshint":"latest"},"directories":{"example":"./example","lib":"./lib","test":"./test"},"engines":{"node":">0.6.0"},"keywords":["phantomjs","phantom","cucumber","cucumberjs","feature","testing"],"licenses":[{"type":"MIT","url":"https://github.com/sheebz/phantom-proxy/blob/master/README.md"}],"main":"index.js","name":"phantom-proxy","private":false,"repository":{"type":"git","url":"https://github.com/sheebz/phantom-proxy"},"version":"0.1.51","readme":"# phantom-proxy\n* Allows you to drive [phantomjs](www.phantomjs.org) from [node](www.nodejs.org)\n* Does not rely on alert side effects for communicating with phantomjs\n* Uses Phantom's embedded mongoose web server for communication - more efficient, simpler, faster.\n* Provides a full api - including a parametrized evaluate function - no more hard coded strings\n* Provides additional useful methods such as waitForSelector\n* Can easily integrate with feature testing frameworks such as [cucumber](https://github.com/cucumber/cucumber-js), jasmine, mocha\n\n## Overview\nPhantomJs is an incredibly useful tool for functional and unit testing.  PhantomJs runs in its own process, making it difficult to drive from node.  Phantom-proxy solves this problem, allowing you to fully drive phantomjs from node.\n\n## Installation\n\n`npm install phantom-proxy`\n\n## Usage\n### Examples\nNavigate to web page and check for body page\n```javascript\nvar phantomProxy = require('phantom-proxy');\n\nphantomProxy.create({}, function (proxy) {\n    var page = proxy.page;\n    page.open('http://www.w3.org', function () {\n        page.waitForSelector('body', function () {\n            console.log('body tag present');\n            proxy.end();\n        });\n    });\n\n});\n```\n\nSame example but, checking for a body tag and rendering a snapshot.\n```javascript\n            phantomProxy.create({\"debug\":true}, function (proxy) {\n                proxy.page.open('http://www.w3.org', function (result) {\n                    assert.equal(result, true);\n                    proxy.page.waitForSelector('body', function (result) {\n                        assert.equal(result, true);\n                        proxy.page.render('./scratch/scratch.png', function (result) {\n                            assert.equal(result, true);\n                            proxy.end(function () {\n                              console.log('done');\n                            });\n                        });\n                    }, 1000);\n                });\n            });\n            ```\n\n\nSee the [API](https://github.com/sheebz/phantom-proxy/blob/master/api.md) documentation for more usage information.\n\n## Revision History\n* 2012-11-06 - version 0.1.5\n - reworked event communication interface - no longer using stdoutput to pass event messages\n - reworked process creation and exit logic\n* 2012-11-03 - version 0.1.3\n  - added callback parameter to end method on proxy.\n  - removed unref call in proxy\n  - added debug option\n* 2012-10-22 - version 0.1.2\n  - breaking - changed the way events are consumed, switched to using nodes emmitter to brodcast events as opposed to invoking instance methods on the object.  To fix issues, use [object].on('eventname') style syntax.\n  - Code clean up\n* 2012-10-17 - version 0.1.16\n   - fixed waitforSelector issue\n* 2012-10-12  - version 0.1.15\n    - fixed a problem w/ waitforSelector fn.\n    - fixed problem where process wasn't shutting down existing server.\n* version 0.1.13\n  - added args property handling for phantom object\n  - added ability to specify port for rpc channel\n  - added timeout on waitforSelector function\n  - added ability to pass cmd line arguments for phantom via options object\n* version 0.1.10\n  - cleaned up and reorganized code\n  - added unit tests\n  - fixed process related issues\n\n","_id":"phantom-proxy@0.1.51","dist":{"shasum":"f8ec0557e63d3403e7f2bd25c230d6a0d0bc1c40","tarball":"https://registry.npmjs.org/phantom-proxy/-/phantom-proxy-0.1.51.tgz","integrity":"sha512-fE6IrDdzeJkCphrxNLBbEpj7HJmJBcVvZGeGC6DmFCQ/K90McDF/5RKwWydSV6iMGnrshbU1+QOfdgC8QoRBGA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDxLClN6PQMpi8VAiy+LlFEOW53X42u1WEyYyp9LzpkxwIgHRcuGsjmDzPN4DsIfa7t0EmchcsZkQhKiNfnz6OvhuY="}]},"_npmVersion":"1.1.62","_npmUser":{"name":"sheebz","email":"rob.schieber@gmail.com"},"maintainers":[{"name":"sheebz","email":"rob.schieber@gmail.com"}]},"0.1.61":{"author":{"name":"Rob Schieber","email":"rob.schieber@gmail.com","url":"https://twitter.com/sheebz"},"bugs":{"mail":"rob.schieber@gmail.com","url":" https://github.com/sheebz/phantom-proxy/issues"},"dependencies":{"colors":"~0.6.0-1","form-data":"~0.0.3","mime":"~1.2.7","q":"~0.8.8","underscore":"~1.4.0"},"description":"a lightweight proxy that lets you to drive phantomjs from node.","devDependencies":{"cucumber":">0.0.0","mocha":"~1.5.0","should":"~1.2.0","jshint":"latest"},"directories":{"example":"./example","lib":"./lib","test":"./test"},"engines":{"node":">0.6.0"},"keywords":["phantomjs","phantom","cucumber","cucumberjs","feature","testing"],"licenses":[{"type":"MIT","url":"https://github.com/sheebz/phantom-proxy/blob/master/README.md"}],"main":"index.js","name":"phantom-proxy","private":false,"repository":{"type":"git","url":"https://github.com/sheebz/phantom-proxy"},"version":"0.1.61","readme":"# phantom-proxy\n* Allows you to drive [phantomjs](www.phantomjs.org) from [node](www.nodejs.org)\n* Does not rely on alert side effects for communicating with phantomjs\n* Uses Phantom's embedded mongoose web server for communication - more efficient, simpler, faster.\n* Provides a full api - including a parametrized evaluate function - no more hard coded strings\n* Provides additional useful methods such as waitForSelector\n* Can easily integrate with feature testing frameworks such as [cucumber](https://github.com/cucumber/cucumber-js), jasmine, mocha\n\n## Overview\nPhantomJs is an incredibly useful tool for functional and unit testing.  PhantomJs runs in its own process, making it difficult to drive from node.  Phantom-proxy solves this problem, allowing you to fully drive phantomjs from node.\n\n## Installation\n\n`npm install phantom-proxy`\n\n## Usage\n### Examples\nNavigate to web page and check for body page\n```javascript\nvar phantomProxy = require('phantom-proxy');\n\nphantomProxy.create({}, function (proxy) {\n    var page = proxy.page;\n    page.open('http://www.w3.org', function () {\n        page.waitForSelector('body', function () {\n            console.log('body tag present');\n            proxy.end();\n        });\n    });\n\n});\n```\n\nSame example but, checking for a body tag and rendering a snapshot.\n```javascript\n            phantomProxy.create({\"debug\":true}, function (proxy) {\n                proxy.page.open('http://www.w3.org', function (result) {\n                    assert.equal(result, true);\n                    proxy.page.waitForSelector('body', function (result) {\n                        assert.equal(result, true);\n                        proxy.page.render('./scratch/scratch.png', function (result) {\n                            assert.equal(result, true);\n                            proxy.end(function () {\n                              console.log('done');\n                            });\n                        });\n                    }, 1000);\n                });\n            });\n            ```\n\n\nSee the [API](https://github.com/sheebz/phantom-proxy/blob/master/api.md) documentation for more usage information.\n\n## Revision History\n* 2012-11-06 - version 0.1.6\n - reworked event communication interface - no longer using stdoutput to pass event messages\n - reworked process creation and exit logic\n* 2012-11-03 - version 0.1.3\n  - added callback parameter to end method on proxy.\n  - removed unref call in proxy\n  - added debug option\n* 2012-10-22 - version 0.1.2\n  - breaking - changed the way events are consumed, switched to using nodes emmitter to brodcast events as opposed to invoking instance methods on the object.  To fix issues, use [object].on('eventname') style syntax.\n  - Code clean up\n* 2012-10-17 - version 0.1.16\n   - fixed waitforSelector issue\n* 2012-10-12  - version 0.1.15\n    - fixed a problem w/ waitforSelector fn.\n    - fixed problem where process wasn't shutting down existing server.\n* version 0.1.13\n  - added args property handling for phantom object\n  - added ability to specify port for rpc channel\n  - added timeout on waitforSelector function\n  - added ability to pass cmd line arguments for phantom via options object\n* version 0.1.10\n  - cleaned up and reorganized code\n  - added unit tests\n  - fixed process related issues\n\n","_id":"phantom-proxy@0.1.61","dist":{"shasum":"18d3c544f3cb198ebbc49b0a30737e5a44dc993f","tarball":"https://registry.npmjs.org/phantom-proxy/-/phantom-proxy-0.1.61.tgz","integrity":"sha512-BmSMG9qXr1+fbTXaUzgrsehNftgtpxp6NKIHRDqSrkuS6MEEsV6Ohav9HvsOa3zqH5i9yGfwn8H7bdLJK/WBLg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIH9d0NgR7u8KYcG4Zi1UuBzGOaXz3VHAHnxxTJbdgwg2AiBwgNyMUriRv9Dk667PTChsExPM5/LZGyArqyLCz2kezQ=="}]},"_npmVersion":"1.1.62","_npmUser":{"name":"sheebz","email":"rob.schieber@gmail.com"},"maintainers":[{"name":"sheebz","email":"rob.schieber@gmail.com"}]},"0.1.62":{"author":{"name":"Rob Schieber","email":"rob.schieber@gmail.com","url":"https://twitter.com/sheebz"},"bugs":{"mail":"rob.schieber@gmail.com","url":" https://github.com/sheebz/phantom-proxy/issues"},"dependencies":{"colors":"~0.6.0-1","form-data":"~0.0.3","mime":"~1.2.7","q":"~0.8.8","underscore":"~1.4.0"},"description":"a lightweight proxy that lets you to drive phantomjs from node.","devDependencies":{"cucumber":">0.0.0","mocha":"~1.5.0","should":"~1.2.0","jshint":"latest","event-stream":">=3.0.7"},"directories":{"example":"./example","lib":"./lib","test":"./test"},"engines":{"node":">0.6.0"},"keywords":["phantomjs","phantom","cucumber","cucumberjs","feature","testing"],"licenses":[{"type":"MIT","url":"https://github.com/sheebz/phantom-proxy/blob/master/README.md"}],"main":"index.js","name":"phantom-proxy","private":false,"repository":{"type":"git","url":"https://github.com/sheebz/phantom-proxy"},"version":"0.1.62","readme":"# phantom-proxy\n* Allows you to drive [phantomjs](www.phantomjs.org) from [node](www.nodejs.org)\n* Does not rely on alert side effects for communicating with phantomjs\n* Uses Phantom's embedded mongoose web server for communication - more efficient, simpler, faster.\n* Provides a full api - including a parametrized evaluate function - no more hard coded strings\n* Provides additional useful methods such as waitForSelector\n* Can easily integrate with feature testing frameworks such as [cucumber](https://github.com/cucumber/cucumber-js), jasmine, mocha\n\n## Overview\nPhantomJs is an incredibly useful tool for functional and unit testing.  PhantomJs runs in its own process, making it difficult to drive from node.  Phantom-proxy solves this problem, allowing you to fully drive phantomjs from node.\n\n## Installation\n\n`npm install phantom-proxy`\n\n## Usage\n### Examples\nNavigate to web page and check for body page\n```javascript\nvar phantomProxy = require('phantom-proxy');\n\nphantomProxy.create({}, function (proxy) {\n    var page = proxy.page;\n    page.open('http://www.w3.org', function () {\n        page.waitForSelector('body', function () {\n            console.log('body tag present');\n            proxy.end();\n        });\n    });\n\n});\n```\n\nSame example but, checking for a body tag and rendering a snapshot.\n```javascript\n            phantomProxy.create({\"debug\":true}, function (proxy) {\n                proxy.page.open('http://www.w3.org', function (result) {\n                    assert.equal(result, true);\n                    proxy.page.waitForSelector('body', function (result) {\n                        assert.equal(result, true);\n                        proxy.page.render('./scratch/scratch.png', function (result) {\n                            assert.equal(result, true);\n                            proxy.end(function () {\n                              console.log('done');\n                            });\n                        });\n                    }, 1000);\n                });\n            });\n            ```\n\n\nSee the [API](https://github.com/sheebz/phantom-proxy/blob/master/api.md) documentation for more usage information.\n\n## Revision History\n* 2012-11-06 - version 0.1.6\n - reworked event communication interface - no longer using stdoutput to pass event messages\n - reworked process creation and exit logic\n* 2012-11-03 - version 0.1.3\n  - added callback parameter to end method on proxy.\n  - removed unref call in proxy\n  - added debug option\n* 2012-10-22 - version 0.1.2\n  - breaking - changed the way events are consumed, switched to using nodes emmitter to brodcast events as opposed to invoking instance methods on the object.  To fix issues, use [object].on('eventname') style syntax.\n  - Code clean up\n* 2012-10-17 - version 0.1.16\n   - fixed waitforSelector issue\n* 2012-10-12  - version 0.1.15\n    - fixed a problem w/ waitforSelector fn.\n    - fixed problem where process wasn't shutting down existing server.\n* version 0.1.13\n  - added args property handling for phantom object\n  - added ability to specify port for rpc channel\n  - added timeout on waitforSelector function\n  - added ability to pass cmd line arguments for phantom via options object\n* version 0.1.10\n  - cleaned up and reorganized code\n  - added unit tests\n  - fixed process related issues\n\n","_id":"phantom-proxy@0.1.62","dist":{"shasum":"7a98ccd3830626840673d35f147a7e123f8daa04","tarball":"https://registry.npmjs.org/phantom-proxy/-/phantom-proxy-0.1.62.tgz","integrity":"sha512-4sxc+z3Y4sCkeVS0yUyEqEzV5j5j41mYbrtzt/XVLUDNzR3kZ7OntLjZpQXp8MJO9ILFS4Z6P1ZWYDrfT8GzLw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIH764dPrsPxI2/7+Lu0LLiOd6E3PXPozzZpfIl9CS+6sAiEAvSAEExFyOSv7Np+yWThAa8nj9a8D0O6GqRK9SbKEzO8="}]},"_npmVersion":"1.1.62","_npmUser":{"name":"sheebz","email":"rob.schieber@gmail.com"},"maintainers":[{"name":"sheebz","email":"rob.schieber@gmail.com"}]},"0.1.64":{"author":{"name":"Rob Schieber","email":"rob.schieber@gmail.com","url":"https://twitter.com/sheebz"},"bugs":{"mail":"rob.schieber@gmail.com","url":" https://github.com/sheebz/phantom-proxy/issues"},"dependencies":{"colors":"~0.6.0-1","form-data":"~0.0.3","mime":"~1.2.7","q":"~0.8.8","underscore":"~1.4.0","event-stream":"~3.0.7"},"description":"a lightweight proxy that lets you to drive phantomjs from node.","devDependencies":{"cucumber":">0.0.0","mocha":"~1.5.0","should":"~1.2.0","jshint":"latest"},"directories":{"example":"./example","lib":"./lib","test":"./test"},"engines":{"node":">0.6.0"},"keywords":["phantomjs","phantom","cucumber","cucumberjs","feature","testing"],"licenses":[{"type":"MIT","url":"https://github.com/sheebz/phantom-proxy/blob/master/README.md"}],"main":"index.js","name":"phantom-proxy","private":false,"repository":{"type":"git","url":"https://github.com/sheebz/phantom-proxy"},"version":"0.1.64","readme":"# phantom-proxy\n* Allows you to drive [phantomjs](www.phantomjs.org) from [node](www.nodejs.org)\n* Does not rely on alert side effects for communicating with phantomjs\n* Uses Phantom's embedded mongoose web server for communication - more efficient, simpler, faster.\n* Provides a full api - including a parametrized evaluate function - no more hard coded strings\n* Provides additional useful methods such as waitForSelector\n* Can easily integrate with feature testing frameworks such as [cucumber](https://github.com/cucumber/cucumber-js), jasmine, mocha\n\n## Overview\nPhantomJs is an incredibly useful tool for functional and unit testing.  PhantomJs runs in its own process, making it difficult to drive from node.  Phantom-proxy solves this problem, allowing you to fully drive phantomjs from node.\n\n## Installation\n\n`npm install phantom-proxy`\n\n## Usage\n### Examples\nNavigate to web page and check for body page\n```javascript\nvar phantomProxy = require('phantom-proxy');\n\nphantomProxy.create({}, function (proxy) {\n    var page = proxy.page;\n    page.open('http://www.w3.org', function () {\n        page.waitForSelector('body', function () {\n            console.log('body tag present');\n            proxy.end();\n        });\n    });\n\n});\n```\n\nSame example but, checking for a body tag and rendering a snapshot.\n```javascript\n            phantomProxy.create({\"debug\":true}, function (proxy) {\n                proxy.page.open('http://www.w3.org', function (result) {\n                    assert.equal(result, true);\n                    proxy.page.waitForSelector('body', function (result) {\n                        assert.equal(result, true);\n                        proxy.page.render('./scratch/scratch.png', function (result) {\n                            assert.equal(result, true);\n                            proxy.end(function () {\n                              console.log('done');\n                            });\n                        });\n                    }, 1000);\n                });\n            });\n            ```\n\n\nSee the [API](https://github.com/sheebz/phantom-proxy/blob/master/api.md) documentation for more usage information.\n\n## Revision History\n* 2012-11-06 - version 0.1.6\n - reworked event communication interface - no longer using stdoutput to pass event messages\n - reworked process creation and exit logic\n* 2012-11-03 - version 0.1.3\n  - added callback parameter to end method on proxy.\n  - removed unref call in proxy\n  - added debug option\n* 2012-10-22 - version 0.1.2\n  - breaking - changed the way events are consumed, switched to using nodes emmitter to brodcast events as opposed to invoking instance methods on the object.  To fix issues, use [object].on('eventname') style syntax.\n  - Code clean up\n* 2012-10-17 - version 0.1.16\n   - fixed waitforSelector issue\n* 2012-10-12  - version 0.1.15\n    - fixed a problem w/ waitforSelector fn.\n    - fixed problem where process wasn't shutting down existing server.\n* version 0.1.13\n  - added args property handling for phantom object\n  - added ability to specify port for rpc channel\n  - added timeout on waitforSelector function\n  - added ability to pass cmd line arguments for phantom via options object\n* version 0.1.10\n  - cleaned up and reorganized code\n  - added unit tests\n  - fixed process related issues\n\n","_id":"phantom-proxy@0.1.64","dist":{"shasum":"1386ee73ae777824c598b1a3857459412509bf7d","tarball":"https://registry.npmjs.org/phantom-proxy/-/phantom-proxy-0.1.64.tgz","integrity":"sha512-SC3FuHHyw8SXY+2nghl9n+rJJzwxAkamgwIWPKG7F3dDYFdpOhUpYAvHWbay1CPWncvxP8G7X8ZGIOska5O/2g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDlZ7w7fdQluw0I36X2zhKow5b8Sb+Ya3nCH952iYmbkgIhAL17AEfMyPGy8gFhjlkRSSL6+F16yrh51EMQp9Wapsnb"}]},"_npmVersion":"1.1.62","_npmUser":{"name":"sheebz","email":"rob.schieber@gmail.com"},"maintainers":[{"name":"sheebz","email":"rob.schieber@gmail.com"}]},"0.1.65":{"author":{"name":"Rob Schieber","email":"rob.schieber@gmail.com","url":"https://twitter.com/sheebz"},"bugs":{"mail":"rob.schieber@gmail.com","url":" https://github.com/sheebz/phantom-proxy/issues"},"dependencies":{"colors":"~0.6.0-1","form-data":"~0.0.3","mime":"~1.2.7","q":"~0.8.8","underscore":"~1.4.0","event-stream":"~3.0.7"},"description":"a lightweight proxy that lets you to drive phantomjs from node.","devDependencies":{"cucumber":">0.0.0","mocha":"~1.5.0","should":"~1.2.0","jshint":"latest"},"directories":{"example":"./example","lib":"./lib","test":"./test"},"engines":{"node":">0.6.0"},"keywords":["phantomjs","phantom","cucumber","cucumberjs","feature","testing"],"licenses":[{"type":"MIT","url":"https://github.com/sheebz/phantom-proxy/blob/master/README.md"}],"main":"index.js","name":"phantom-proxy","private":false,"repository":{"type":"git","url":"https://github.com/sheebz/phantom-proxy"},"version":"0.1.65","readme":"# phantom-proxy\n* Allows you to drive [phantomjs](www.phantomjs.org) from [node](www.nodejs.org)\n* Does not rely on alert side effects for communicating with phantomjs\n* Uses Phantom's embedded mongoose web server for communication - more efficient, simpler, faster.\n* Provides a full api - including a parametrized evaluate function - no more hard coded strings\n* Provides additional useful methods such as waitForSelector\n* Can easily integrate with feature testing frameworks such as [cucumber](https://github.com/cucumber/cucumber-js), jasmine, mocha\n\n## Overview\nPhantomJs is an incredibly useful tool for functional and unit testing.  PhantomJs runs in its own process, making it difficult to drive from node.  Phantom-proxy solves this problem, allowing you to fully drive phantomjs from node.\n\n## Installation\n\n`npm install phantom-proxy`\n\n## Usage\n### Examples\nNavigate to web page and check for body page\n```javascript\nvar phantomProxy = require('phantom-proxy');\n\nphantomProxy.create({}, function (proxy) {\n    var page = proxy.page;\n    page.open('http://www.w3.org', function () {\n        page.waitForSelector('body', function () {\n            console.log('body tag present');\n            proxy.end();\n        });\n    });\n\n});\n```\n\nSame example but, checking for a body tag and rendering a snapshot.\n```javascript\n            phantomProxy.create({\"debug\":true}, function (proxy) {\n                proxy.page.open('http://www.w3.org', function (result) {\n                    assert.equal(result, true);\n                    proxy.page.waitForSelector('body', function (result) {\n                        assert.equal(result, true);\n                        proxy.page.render('./scratch/scratch.png', function (result) {\n                            assert.equal(result, true);\n                            proxy.end(function () {\n                              console.log('done');\n                            });\n                        });\n                    }, 1000);\n                });\n            });\n            ```\n\n\nSee the [API](https://github.com/sheebz/phantom-proxy/blob/master/api.md) documentation for more usage information.\n\n## Revision History\n* 2012-11-06 - version 0.1.6\n - reworked event communication interface - no longer using stdoutput to pass event messages\n - reworked process creation and exit logic\n* 2012-11-03 - version 0.1.3\n  - added callback parameter to end method on proxy.\n  - removed unref call in proxy\n  - added debug option\n* 2012-10-22 - version 0.1.2\n  - breaking - changed the way events are consumed, switched to using nodes emmitter to brodcast events as opposed to invoking instance methods on the object.  To fix issues, use [object].on('eventname') style syntax.\n  - Code clean up\n* 2012-10-17 - version 0.1.16\n   - fixed waitforSelector issue\n* 2012-10-12  - version 0.1.15\n    - fixed a problem w/ waitforSelector fn.\n    - fixed problem where process wasn't shutting down existing server.\n* version 0.1.13\n  - added args property handling for phantom object\n  - added ability to specify port for rpc channel\n  - added timeout on waitforSelector function\n  - added ability to pass cmd line arguments for phantom via options object\n* version 0.1.10\n  - cleaned up and reorganized code\n  - added unit tests\n  - fixed process related issues\n\n","_id":"phantom-proxy@0.1.65","dist":{"shasum":"032ead467f43b53678ef6ccb2112346fbe483407","tarball":"https://registry.npmjs.org/phantom-proxy/-/phantom-proxy-0.1.65.tgz","integrity":"sha512-x8PZIsjXJKIK3xUnzfc3BIE+U64x90X0/6PPc9fzPej0PXdchBetFyIgVGySRXDzwyKtG1Ynf8qoLmvFDGFYZQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGdTSQJ/5c73ujzY/Bu8LzgbHUaC6GoPpvF1ryxztp9BAiEA84H3dv+FabO9tB1ZcFj+RGv+3yOg1Re7PqTqTy1JFao="}]},"_npmVersion":"1.1.62","_npmUser":{"name":"sheebz","email":"rob.schieber@gmail.com"},"maintainers":[{"name":"sheebz","email":"rob.schieber@gmail.com"}]},"0.1.66":{"author":{"name":"Rob Schieber","email":"rob.schieber@gmail.com","url":"https://twitter.com/sheebz"},"bugs":{"mail":"rob.schieber@gmail.com","url":" https://github.com/sheebz/phantom-proxy/issues"},"dependencies":{"colors":"~0.6.0-1","form-data":"~0.0.3","mime":"~1.2.7","q":"~0.8.8","underscore":"~1.4.0","event-stream":"~3.0.7"},"description":"a lightweight proxy that lets you to drive phantomjs from node.","devDependencies":{"cucumber":">0.0.0","mocha":"~1.5.0","should":"~1.2.0","jshint":"latest"},"directories":{"example":"./example","lib":"./lib","test":"./test"},"engines":{"node":">0.6.0"},"keywords":["phantomjs","phantom","cucumber","cucumberjs","feature","testing"],"licenses":[{"type":"MIT","url":"https://github.com/sheebz/phantom-proxy/blob/master/README.md"}],"main":"index.js","name":"phantom-proxy","private":false,"repository":{"type":"git","url":"https://github.com/sheebz/phantom-proxy"},"version":"0.1.66","readme":"# phantom-proxy\n* Allows you to drive [phantomjs](www.phantomjs.org) from [node](www.nodejs.org)\n* Does not rely on alert side effects for communicating with phantomjs\n* Uses Phantom's embedded mongoose web server for communication - more efficient, simpler, faster.\n* Provides a full api - including a parametrized evaluate function - no more hard coded strings\n* Provides additional useful methods such as waitForSelector\n* Can easily integrate with feature testing frameworks such as [cucumber](https://github.com/cucumber/cucumber-js), jasmine, mocha\n\n## Overview\nPhantomJs is an incredibly useful tool for functional and unit testing.  PhantomJs runs in its own process, making it difficult to drive from node.  Phantom-proxy solves this problem, allowing you to fully drive phantomjs from node.\n\n## Installation\n\n`npm install phantom-proxy`\n\n## Usage\n### Examples\nNavigate to web page and check for body page\n```javascript\nvar phantomProxy = require('phantom-proxy');\n\nphantomProxy.create({}, function (proxy) {\n    var page = proxy.page;\n    page.open('http://www.w3.org', function () {\n        page.waitForSelector('body', function () {\n            console.log('body tag present');\n            proxy.end();\n        });\n    });\n\n});\n```\n\nSame example but, checking for a body tag and rendering a snapshot.\n```javascript\n            phantomProxy.create({\"debug\":true}, function (proxy) {\n                proxy.page.open('http://www.w3.org', function (result) {\n                    assert.equal(result, true);\n                    proxy.page.waitForSelector('body', function (result) {\n                        assert.equal(result, true);\n                        proxy.page.render('./scratch/scratch.png', function (result) {\n                            assert.equal(result, true);\n                            proxy.end(function () {\n                              console.log('done');\n                            });\n                        });\n                    }, 1000);\n                });\n            });\n            ```\n\n\nSee the [API](https://github.com/sheebz/phantom-proxy/blob/master/api.md) documentation for more usage information.\n\n## Revision History\n* 2012-11-06 - version 0.1.6\n - reworked event communication interface - no longer using stdoutput to pass event messages\n - reworked process creation and exit logic\n* 2012-11-03 - version 0.1.3\n  - added callback parameter to end method on proxy.\n  - removed unref call in proxy\n  - added debug option\n* 2012-10-22 - version 0.1.2\n  - breaking - changed the way events are consumed, switched to using nodes emmitter to brodcast events as opposed to invoking instance methods on the object.  To fix issues, use [object].on('eventname') style syntax.\n  - Code clean up\n* 2012-10-17 - version 0.1.16\n   - fixed waitforSelector issue\n* 2012-10-12  - version 0.1.15\n    - fixed a problem w/ waitforSelector fn.\n    - fixed problem where process wasn't shutting down existing server.\n* version 0.1.13\n  - added args property handling for phantom object\n  - added ability to specify port for rpc channel\n  - added timeout on waitforSelector function\n  - added ability to pass cmd line arguments for phantom via options object\n* version 0.1.10\n  - cleaned up and reorganized code\n  - added unit tests\n  - fixed process related issues\n\n","_id":"phantom-proxy@0.1.66","dist":{"shasum":"3f6f0ee0236092d4f7b6194efbbda2a3c9c0ea3f","tarball":"https://registry.npmjs.org/phantom-proxy/-/phantom-proxy-0.1.66.tgz","integrity":"sha512-DENj+jiiYp6PNs6GeNS3KJwnezIn/AyeItD6zqRvo6d62vKcXckE+MzxiICqg/AhbxtaZ4TDCq/PnOK2pTucNw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICDSjjR/EXNUiyv9oSEM2pDBozoSbBy7Ypeikf8SMyrpAiEA+/8kLNqta21Uls0YPDsmt0TRpNBlkfjdESqBF1N9mmQ="}]},"_npmVersion":"1.1.62","_npmUser":{"name":"sheebz","email":"rob.schieber@gmail.com"},"maintainers":[{"name":"sheebz","email":"rob.schieber@gmail.com"}]},"0.1.67":{"author":{"name":"Rob Schieber","email":"rob.schieber@gmail.com","url":"https://twitter.com/sheebz"},"bugs":{"mail":"rob.schieber@gmail.com","url":" https://github.com/sheebz/phantom-proxy/issues"},"dependencies":{"colors":"~0.6.0-1","form-data":"~0.0.3","mime":"~1.2.7","q":"~0.8.8","underscore":"~1.4.0","event-stream":"~3.0.7"},"description":"a lightweight proxy that lets you to drive phantomjs from node.","devDependencies":{"cucumber":">0.0.0","mocha":"~1.5.0","should":"~1.2.0","jshint":"latest"},"directories":{"example":"./example","lib":"./lib","test":"./test"},"engines":{"node":">0.6.0"},"keywords":["phantomjs","phantom","cucumber","cucumberjs","feature","testing"],"licenses":[{"type":"MIT","url":"https://github.com/sheebz/phantom-proxy/blob/master/README.md"}],"main":"index.js","name":"phantom-proxy","private":false,"repository":{"type":"git","url":"https://github.com/sheebz/phantom-proxy"},"version":"0.1.67","readme":"# phantom-proxy\n* Allows you to drive [phantomjs](www.phantomjs.org) from [node](www.nodejs.org)\n* Does not rely on alert side effects for communicating with phantomjs\n* Uses Phantom's embedded mongoose web server for communication - more efficient, simpler, faster.\n* Provides a full api - including a parametrized evaluate function - no more hard coded strings\n* Provides additional useful methods such as waitForSelector\n* Can easily integrate with feature testing frameworks such as [cucumber](https://github.com/cucumber/cucumber-js), jasmine, mocha\n\n## Overview\nPhantomJs is an incredibly useful tool for functional and unit testing.  PhantomJs runs in its own process, making it difficult to drive from node.  Phantom-proxy solves this problem, allowing you to fully drive phantomjs from node.\n\n## Installation\n\n`npm install phantom-proxy`\n\n## Usage\n### Examples\nSee the [API](https://github.com/sheebz/phantom-proxy/blob/master/api.md) documentation for more usage information.\n\n#### wait for a specific selector to appear\n```javascript\nvar phantomProxy = require('phantom-proxy');\n\nphantomProxy.create({}, function (proxy) {\n    var page = proxy.page;\n    page.open('http://www.w3.org', function () {\n        page.waitForSelector('body', function () {\n            console.log('body tag present');\n            proxy.end();\n        });\n    });\n\n});\n```\n\n#### render a screenshot\n```javascript\nphantomProxy.create({\"debug\":true}, function (proxy) {\n    proxy.page.open('http://www.w3.org', function (result) {\n        assert.equal(result, true);\n        proxy.page.waitForSelector('body', function (result) {\n            assert.equal(result, true);\n            proxy.page.render('./scratch/scratch.png', function (result) {\n                assert.equal(result, true);\n                proxy.end(function () {\n                  console.log('done');\n                });\n            });\n        }, 1000);\n    });\n});\n            \n```\n\n#### subscribe to events - see api docs for complete list\n```javascript\nphantomProxy.create({\"debug\":true}, function (proxy) {\n    self.proxy.page.on('navigationRequested', function (url) {\n      console.log('at %s', url);\n      \n      if (url === 'http://www.w3.org') {\n        console.log('at w3.org');\n      }\n      else {\n        console.log('how did we get here?');\n      }\n    });\n    proxy.page.open('http://www.w3.org', function (result) {\n      proxy.page.on('alert', function (msg) {\n          if (msg.trim() === 'hello') {\n              console.log('it said hello');\n          }\n      });\n\n\n      proxy.end(function () {\n        console.log('done');\n      });\n    });\n});\n            \n```\n\n\n\n## Revision History\n* 2012-11-06 - version 0.1.6\n - reworked event communication interface - no longer using stdoutput to pass event messages\n - reworked process creation and exit logic \n - startup time and event latency are much improved - should run much faster than before\n* 2012-11-03 - version 0.1.3\n  - added callback parameter to end method on proxy.\n  - removed unref call in proxy\n  - added debug option\n* 2012-10-22 - version 0.1.2\n  - breaking - changed the way events are consumed, switched to using nodes emmitter to brodcast events as opposed to invoking instance methods on the object.  To fix issues, use [object].on('eventname') style syntax.\n  - Code clean up\n* 2012-10-17 - version 0.1.16\n   - fixed waitforSelector issue\n* 2012-10-12  - version 0.1.15\n    - fixed a problem w/ waitforSelector fn.\n    - fixed problem where process wasn't shutting down existing server.\n* version 0.1.13\n  - added args property handling for phantom object\n  - added ability to specify port for rpc channel\n  - added timeout on waitforSelector function\n  - added ability to pass cmd line arguments for phantom via options object\n* version 0.1.10\n  - cleaned up and reorganized code\n  - added unit tests\n  - fixed process related issues\n\n","_id":"phantom-proxy@0.1.67","dist":{"shasum":"dfdffc01cb732bccc0f49d11262196ec2035bf9a","tarball":"https://registry.npmjs.org/phantom-proxy/-/phantom-proxy-0.1.67.tgz","integrity":"sha512-eku6PJYF94DzCkYgSHaksqWutg8VjBAhiDFMljKRvEcESriqtUCau0cr9RuT1obyK0ZeQgBxo6Bbcx2iIlwV/w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAtpLQ4QXJZ6zbXZNIuEeXvGABcbt5JOjMWNM04aR/nLAiEA7UjdqHTgALTGm9g5wYUC7053DxPf2jRYRPQZFDI9u64="}]},"_npmVersion":"1.1.62","_npmUser":{"name":"sheebz","email":"rob.schieber@gmail.com"},"maintainers":[{"name":"sheebz","email":"rob.schieber@gmail.com"}]},"0.1.68":{"author":{"name":"Rob Schieber","email":"rob.schieber@gmail.com","url":"https://twitter.com/sheebz"},"bugs":{"mail":"rob.schieber@gmail.com","url":" https://github.com/sheebz/phantom-proxy/issues"},"dependencies":{"colors":"~0.6.0-1","form-data":"~0.0.3","mime":"~1.2.7","q":"~0.8.8","underscore":"~1.4.0","event-stream":"~3.0.7"},"description":"a lightweight proxy that lets you to drive phantomjs from node.","devDependencies":{"cucumber":">0.0.0","mocha":"~1.5.0","should":"~1.2.0","jshint":"latest"},"directories":{"example":"./example","lib":"./lib","test":"./test"},"engines":{"node":">0.6.0"},"keywords":["phantomjs","phantom","cucumber","cucumberjs","feature","testing"],"licenses":[{"type":"MIT","url":"https://github.com/sheebz/phantom-proxy/blob/master/README.md"}],"main":"index.js","name":"phantom-proxy","private":false,"repository":{"type":"git","url":"https://github.com/sheebz/phantom-proxy"},"version":"0.1.68","readme":"# phantom-proxy\n* Allows you to drive [phantomjs](www.phantomjs.org) from [node](www.nodejs.org)\n* Does not rely on alert side effects for communicating with phantomjs\n* Uses Phantom's embedded mongoose web server for communication - more efficient, simpler, faster.\n* Provides a full api - including a parametrized evaluate function - no more hard coded strings\n* Provides additional useful methods such as waitForSelector\n* Can easily integrate with feature testing frameworks such as [cucumber](https://github.com/cucumber/cucumber-js), jasmine, mocha\n\n## Overview\nPhantomJs is an incredibly useful tool for functional and unit testing.  PhantomJs runs in its own process, making it difficult to drive from node.  Phantom-proxy solves this problem, allowing you to fully drive phantomjs from node.\n\n## Installation\n\n`npm install phantom-proxy`\n\n## Usage\n### Examples\nSee the [API](https://github.com/sheebz/phantom-proxy/blob/master/api.md) documentation for more usage information.\n\n#### wait for a specific selector to appear\n```javascript\nvar phantomProxy = require('phantom-proxy');\n\nphantomProxy.create({}, function (proxy) {\n    var page = proxy.page;\n    page.open('http://www.w3.org', function () {\n        page.waitForSelector('body', function () {\n            console.log('body tag present');\n            proxy.end();\n        });\n    });\n\n});\n```\n\n#### render a screenshot\n```javascript\nphantomProxy.create({\"debug\":true}, function (proxy) {\n    proxy.page.open('http://www.w3.org', function (result) {\n        assert.equal(result, true);\n        proxy.page.waitForSelector('body', function (result) {\n            assert.equal(result, true);\n            proxy.page.render('./scratch/scratch.png', function (result) {\n                assert.equal(result, true);\n                proxy.end(function () {\n                  console.log('done');\n                });\n            });\n        }, 1000);\n    });\n});\n            \n```\n\n#### subscribe to events - see api docs for complete list\n```javascript\nphantomProxy.create({\"debug\":true}, function (proxy) {\n    self.proxy.page.on('navigationRequested', function (url) {\n      console.log('at %s', url);\n      \n      if (url === 'http://www.w3.org') {\n        console.log('at w3.org');\n      }\n      else {\n        console.log('how did we get here?');\n      }\n    });\n    proxy.page.open('http://www.w3.org', function (result) {\n      proxy.page.on('alert', function (msg) {\n          if (msg.trim() === 'hello') {\n              console.log('it said hello');\n          }\n      });\n\n\n      proxy.end(function () {\n        console.log('done');\n      });\n    });\n});\n            \n```\n\n\n\n## Revision History\n* 2012-11-06 - version 0.1.6\n - reworked event communication interface - no longer using stdoutput to pass event messages\n - reworked process creation and exit logic \n - startup time and event latency are much improved - should run much faster than before\n* 2012-11-03 - version 0.1.3\n  - added callback parameter to end method on proxy.\n  - removed unref call in proxy\n  - added debug option\n* 2012-10-22 - version 0.1.2\n  - breaking - changed the way events are consumed, switched to using nodes emmitter to brodcast events as opposed to invoking instance methods on the object.  To fix issues, use [object].on('eventname') style syntax.\n  - Code clean up\n* 2012-10-17 - version 0.1.16\n   - fixed waitforSelector issue\n* 2012-10-12  - version 0.1.15\n    - fixed a problem w/ waitforSelector fn.\n    - fixed problem where process wasn't shutting down existing server.\n* version 0.1.13\n  - added args property handling for phantom object\n  - added ability to specify port for rpc channel\n  - added timeout on waitforSelector function\n  - added ability to pass cmd line arguments for phantom via options object\n* version 0.1.10\n  - cleaned up and reorganized code\n  - added unit tests\n  - fixed process related issues\n\n","_id":"phantom-proxy@0.1.68","dist":{"shasum":"1037f0269ed2003ddfa61152e1aeeb888e8a7f8c","tarball":"https://registry.npmjs.org/phantom-proxy/-/phantom-proxy-0.1.68.tgz","integrity":"sha512-uvZZ4MVabUtd0KYyWqZ1lXGNuxfml2YK1LgWVGrob3attrPuO1pFdcYs+mckUZPBJ9va3j4ETRyzlKaAUEfpwg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDSYPBTYeDVAmdBCmVgmqn1rwnmWzRMNanLyfBT1IhkeAiEAixVd+7CsmwrVQsINdtFBemCS2cIfiD/BvZDrD+2h2WQ="}]},"_npmVersion":"1.1.62","_npmUser":{"name":"sheebz","email":"rob.schieber@gmail.com"},"maintainers":[{"name":"sheebz","email":"rob.schieber@gmail.com"}]},"0.1.69":{"author":{"name":"Rob Schieber","email":"rob.schieber@gmail.com","url":"https://twitter.com/sheebz"},"bugs":{"mail":"rob.schieber@gmail.com","url":" https://github.com/sheebz/phantom-proxy/issues"},"dependencies":{"colors":"~0.6.0-1","form-data":"~0.0.3","mime":"~1.2.7","q":"~0.8.8","underscore":"~1.4.0","event-stream":"~3.0.7"},"description":"a lightweight proxy that lets you to drive phantomjs from node.","devDependencies":{"cucumber":">0.0.0","mocha":"~1.5.0","should":"~1.2.0","jshint":"latest"},"directories":{"example":"./example","lib":"./lib","test":"./test"},"engines":{"node":">0.6.0"},"keywords":["phantomjs","phantom","cucumber","cucumberjs","feature","testing"],"licenses":[{"type":"MIT","url":"https://github.com/sheebz/phantom-proxy/blob/master/README.md"}],"main":"index.js","name":"phantom-proxy","private":false,"repository":{"type":"git","url":"https://github.com/sheebz/phantom-proxy"},"version":"0.1.69","readme":"# phantom-proxy\n* Allows you to drive [phantomjs](www.phantomjs.org) from [node](www.nodejs.org)\n* Does not rely on alert side effects for communicating with phantomjs\n* Uses Phantom's embedded mongoose web server for communication - more efficient, simpler, faster.\n* Provides a full api - including a parametrized evaluate function - no more hard coded strings\n* Provides additional useful methods such as waitForSelector\n* Can easily integrate with feature testing frameworks such as [cucumber](https://github.com/cucumber/cucumber-js), jasmine, mocha\n\n## Overview\nPhantomJs is an incredibly useful tool for functional and unit testing.  PhantomJs runs in its own process, making it difficult to drive from node.  Phantom-proxy solves this problem, allowing you to fully drive phantomjs from node.\n\n## Installation\n\n`npm install phantom-proxy`\n\n## Usage\n### Examples\nSee the [API](https://github.com/sheebz/phantom-proxy/blob/master/api.md) documentation for more usage information.\n\n#### wait for a specific selector to appear\n```javascript\nvar phantomProxy = require('phantom-proxy');\n\nphantomProxy.create({}, function (proxy) {\n    var page = proxy.page;\n    page.open('http://www.w3.org', function () {\n        page.waitForSelector('body', function () {\n            console.log('body tag present');\n            proxy.end();\n        });\n    });\n\n});\n```\n\n#### render a screenshot\n```javascript\nphantomProxy.create({\"debug\":true}, function (proxy) {\n    proxy.page.open('http://www.w3.org', function (result) {\n        assert.equal(result, true);\n        proxy.page.waitForSelector('body', function (result) {\n            assert.equal(result, true);\n            proxy.page.render('./scratch/scratch.png', function (result) {\n                assert.equal(result, true);\n                proxy.end(function () {\n                  console.log('done');\n                });\n            });\n        }, 1000);\n    });\n});\n            \n```\n\n#### subscribe to events - see api docs for complete list\n```javascript\nphantomProxy.create({\"debug\":true}, function (proxy) {\n    self.proxy.page.on('navigationRequested', function (url) {\n      console.log('at %s', url);\n      \n      if (url === 'http://www.w3.org') {\n        console.log('at w3.org');\n      }\n      else {\n        console.log('how did we get here?');\n      }\n      \n      proxy.end(function () {\n        console.log('done');\n      });\n    });\n    \n    proxy.page.open('http://www.w3.org', function (result) {\n      proxy.page.on('alert', function (msg) {\n          if (msg.trim() === 'hello') {\n              console.log('it said hello');\n          }\n          \n        proxy.end(function () {\n          console.log('done');\n        });\n      });\n\n\n\n    });\n});\n            \n```\n# API Documentation\n## phantomProxy object\n### create([options], callbackFn)\nuse this method to create an instance of the phantom proxy objects.  The return value will be an object with a page proxy and a phantom proxy.  These properties correspond to the phantom and webpage objects on the native phantom API.\n\nWhen this method is called, a new phantomjs process is spawned.  The new phantomjs process creates a mongoose webserver on localhost:1061.  All subsequent communication with phantom occurs via http requests.\n\n#### Options argument (experimental)\nCreate accepts an options object as the first parameter.  This argument is optional.  Properties and their default values are listed below.\n\n```javascript\n\n        var defaultoptions = {\n            'ignoreSslErrors':true,\n            'localToRemoteUrlAccessEnabled':true,\n            'cookiesFile':'cookies.txt',\n            'diskCache':'yes',\n            'loadImages':'yes',\n            'localToRemoteUrlAccess':'no',\n            'maxDiskCache':'50000',\n            'outputEncoding':'utf8',\n            'proxy':'0',\n            'proxyType':'yes',\n            'scriptEncoding':'yes',\n            'webSecurity':'yes',\n            'port':1061\n        };\n```\n\n### end(callbackFn)\nYou should call end on the returned proxy object to ensure that phantomjs is properly shut down.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create(function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  //do some stuff...\n  //...\n  //call end when done\n  proxy.end(function(){\n    console.log('phantom has exited');\n  });\n});\n```\n\n## phantom Object\nThe phantom object corresponds to the phantom object in the native phantomJs API.\n\n## Page Object\nThe page object corresponds to the webpage object in the native phantomJs API.\n\n### set(propertyName, propertyValue, callbackFn)\nsets property on page object\n\n```javascript\n  //set viewport size for browser window\n  proxy.page.set('viewportSize',\n  { width:320, height:480 }, function (result) {\n      console.log(result.toString().cyan);\n      worldCallback.call(self);\n  });\n```\n\n### open(url, callbackFn)\nOpens a webpage with url and callback function arguments.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    console.log('page now open');\n\n    //close proxy\n    phantomProxy.end();\n  });\n\n});\n```\n\n### waitForSelector(selector, callbackFn, timeout)\nPolls page for presence of selector, executes callback when selector is present.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n\n        //close proxy\n        phantomProxy.end();\n    });\n    console.log('page now open');\n  });\n\n});\n```\n\n### render(fileName, callbackFn)\nRenders a image of browser.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n      page.render('myimage.png', function(){\n        console.log('saved my picture!');\n\n        //close proxy\n        phantomProxy.end();\n      });\n    });\n    console.log('page now open');\n  });\n\n});\n```\n\n### renderBase64(type, callbackFn)\nReturns a base64 representation of image.\n\n### evaluate(functionToEvaluate, callbackFn, [arg1, arg2,... argN]\nExecutes functionToEvaluate in phantomJS browser.  Once function executes, callbackFn will be invoked with a result parameter. The Third and sebsequent arguments represent optional parameters which will be passed to the functionToEvaluate function when it is invoked in the browser.\n\n## Events\nThe following events are supported, see [PhantomJs Docs](https://github.com/ariya/phantomjs/wiki/API-Reference) for more information.\n\n<table><thead><th>Event Name</th><th>Notes</th></thead>\n<tbody>\n<tr><td>urlChanged</td><td></td></tr>\n<tr><td>resourceReceived</td><td></td></tr>\n<tr><td>resourceRequested</td><td></td></tr>\n<tr><td>prompt</td><td>Event will fire, but callback will not execute in phantomjs context</td></tr>\n<tr><td>pageCreated</td><td></td></tr>\n<tr><td>navigationRequested</td><td></td></tr>\n<tr><td>loadStarted</td><td></td></tr>\n<tr><td>loadFinished</td><td></td></tr>\n<tr><td>initialized</td><td></td></tr>\n<tr><td>error</td><td></td></tr>\n<tr><td>consoleMessage</td><td></td></tr>\n<tr><td>confirm</td><td>Event will fire, but callback will not execute in phantomjs context</td></tr>\n<tr><td>closing</td><td></td></tr>\n<tr><td>callback</td><td></td></tr>\n<tr><td>alert</td><td></td></tr>\n</tbody>\n</table>\n\n\n#### Subscribing to events\n\n```javascript\nphantomProxy = require('phantom-proxy');\nphantomProxy.create({}, function (proxy) {\n    proxy.page.on('urlChanged', function(){\n      console.log('url changed');\n    });\n});\n```\n\n\n\n\n## Revision History\n* 2012-11-06 - version 0.1.6\n - reworked event communication interface - no longer using stdoutput to pass event messages\n - reworked process creation and exit logic \n - startup time and event latency are much improved - should run much faster than before\n* 2012-11-03 - version 0.1.3\n  - added callback parameter to end method on proxy.\n  - removed unref call in proxy\n  - added debug option\n* 2012-10-22 - version 0.1.2\n  - breaking - changed the way events are consumed, switched to using nodes emmitter to brodcast events as opposed to invoking instance methods on the object.  To fix issues, use [object].on('eventname') style syntax.\n  - Code clean up\n* 2012-10-17 - version 0.1.16\n   - fixed waitforSelector issue\n* 2012-10-12  - version 0.1.15\n    - fixed a problem w/ waitforSelector fn.\n    - fixed problem where process wasn't shutting down existing server.\n* version 0.1.13\n  - added args property handling for phantom object\n  - added ability to specify port for rpc channel\n  - added timeout on waitforSelector function\n  - added ability to pass cmd line arguments for phantom via options object\n* version 0.1.10\n  - cleaned up and reorganized code\n  - added unit tests\n  - fixed process related issues\n\n","_id":"phantom-proxy@0.1.69","dist":{"shasum":"c7b963cf8703bbac4a43b9d8eab4c1e272e5e565","tarball":"https://registry.npmjs.org/phantom-proxy/-/phantom-proxy-0.1.69.tgz","integrity":"sha512-F8lM82TN8hIvuyATrE5KYGX6e0ja4fJfz4XHL3XXi0As5OHxtWyQq1kf+0Ew5FdnhQLf4sXOpsyDDDERz5ZVww==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBZJAryA8KDYgT5JGC9ZiHI7u3X2hIq92DNTSQovy8fXAiBTn5CFWqgkPHcMGfT8R3PKCEYDXmyrOzzKbNAc2Hk6fQ=="}]},"_npmVersion":"1.1.62","_npmUser":{"name":"sheebz","email":"rob.schieber@gmail.com"},"maintainers":[{"name":"sheebz","email":"rob.schieber@gmail.com"}]},"0.1.71":{"author":{"name":"Rob Schieber","email":"rob.schieber@gmail.com","url":"https://twitter.com/sheebz"},"bugs":{"mail":"rob.schieber@gmail.com","url":" https://github.com/sheebz/phantom-proxy/issues"},"dependencies":{"colors":"~0.6.0-1","form-data":"~0.0.3","mime":"~1.2.7","q":"~0.8.8","underscore":"~1.4.0","event-stream":"~3.0.7"},"description":"a lightweight proxy that lets you to drive phantomjs from node.","devDependencies":{"cucumber":">0.0.0","mocha":"~1.5.0","should":"~1.2.0","jshint":"latest"},"directories":{"example":"./example","lib":"./lib","test":"./test"},"engines":{"node":">0.6.0"},"keywords":["phantomjs","phantom","cucumber","cucumberjs","feature","testing"],"licenses":[{"type":"MIT","url":"https://github.com/sheebz/phantom-proxy/blob/master/README.md"}],"main":"index.js","name":"phantom-proxy","private":false,"repository":{"type":"git","url":"https://github.com/sheebz/phantom-proxy"},"version":"0.1.71","readme":"# phantom-proxy\n* Allows you to drive [phantomjs](www.phantomjs.org) from [node](www.nodejs.org)\n* Does not rely on alert side effects for communicating with phantomjs\n* Uses Phantom's embedded mongoose web server for communication - more efficient, simpler, faster.\n* Provides a full api - including a parametrized evaluate function - no more hard coded strings\n* Provides additional useful methods such as waitForSelector\n* Can easily integrate with feature testing frameworks such as [cucumber](https://github.com/cucumber/cucumber-js), jasmine, mocha\n\n## Overview\nPhantomJs is an incredibly useful tool for functional and unit testing.  PhantomJs runs in its own process, making it difficult to drive from node.  Phantom-proxy solves this problem, allowing you to fully drive phantomjs from node.\n\n## Installation\n\n`npm install phantom-proxy`\n\n## Usage\n### Examples\nSee the [API](https://github.com/sheebz/phantom-proxy/blob/master/api.md) documentation for more usage information.\n\n#### wait for a specific selector to appear\n```javascript\nvar phantomProxy = require('phantom-proxy');\n\nphantomProxy.create({}, function (proxy) {\n    var page = proxy.page;\n    page.open('http://www.w3.org', function () {\n        page.waitForSelector('body', function () {\n            console.log('body tag present');\n            proxy.end();\n        });\n    });\n\n});\n```\n\n#### render a screenshot\n```javascript\nphantomProxy.create({\"debug\":true}, function (proxy) {\n    proxy.page.open('http://www.w3.org', function (result) {\n        assert.equal(result, true);\n        proxy.page.waitForSelector('body', function (result) {\n            assert.equal(result, true);\n            proxy.page.render('./scratch/scratch.png', function (result) {\n                assert.equal(result, true);\n                proxy.end(function () {\n                  console.log('done');\n                });\n            });\n        }, 1000);\n    });\n});\n            \n```\n\n#### subscribe to events - see api docs for complete list\n```javascript\nphantomProxy.create({\"debug\":true}, function (proxy) {\n    self.proxy.page.on('navigationRequested', function (url) {\n      console.log('at %s', url);\n      \n      if (url === 'http://www.w3.org') {\n        console.log('at w3.org');\n      }\n      else {\n        console.log('how did we get here?');\n      }\n      \n      proxy.end(function () {\n        console.log('done');\n      });\n    });\n    \n    proxy.page.open('http://www.w3.org', function (result) {\n      proxy.page.on('alert', function (msg) {\n          if (msg.trim() === 'hello') {\n              console.log('it said hello');\n          }\n          \n        proxy.end(function () {\n          console.log('done');\n        });\n      });\n\n\n\n    });\n});\n            \n```\n# API Documentation\n## phantomProxy object\n### create([options], callbackFn)\nuse this method to create an instance of the phantom proxy objects.  The return value will be an object with a page proxy and a phantom proxy.  These properties correspond to the phantom and webpage objects on the native phantom API.\n\nWhen this method is called, a new phantomjs process is spawned.  The new phantomjs process creates a mongoose webserver on localhost:1061.  All subsequent communication with phantom occurs via http requests.\n\n#### Options argument (experimental)\nCreate accepts an options object as the first parameter.  This argument is optional.  Properties and their default values are listed below.\n\n```javascript\n\n        var defaultoptions = {\n            'ignoreSslErrors':true,\n            'localToRemoteUrlAccessEnabled':true,\n            'cookiesFile':'cookies.txt',\n            'diskCache':'yes',\n            'loadImages':'yes',\n            'localToRemoteUrlAccess':'no',\n            'maxDiskCache':'50000',\n            'outputEncoding':'utf8',\n            'proxy':'0',\n            'proxyType':'yes',\n            'scriptEncoding':'yes',\n            'webSecurity':'yes',\n            'port':1061\n        };\n```\n\n### end(callbackFn)\nYou should call end on the returned proxy object to ensure that phantomjs is properly shut down.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create(function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  //do some stuff...\n  //...\n  //call end when done\n  proxy.end(function(){\n    console.log('phantom has exited');\n  });\n});\n```\n\n## phantom Object\nThe phantom object corresponds to the phantom object in the native phantomJs API.\n\n## Page Object\nThe page object corresponds to the webpage object in the native phantomJs API.\n\n### set(propertyName, propertyValue, callbackFn)\nsets property on page object\n\n```javascript\n  //set viewport size for browser window\n  proxy.page.set('viewportSize',\n  { width:320, height:480 }, function (result) {\n      console.log(result.toString().cyan);\n      worldCallback.call(self);\n  });\n```\n\n### open(url, callbackFn)\nOpens a webpage with url and callback function arguments.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    console.log('page now open');\n\n    //close proxy\n    phantomProxy.end();\n  });\n\n});\n```\n\n### waitForSelector(selector, callbackFn, timeout)\nPolls page for presence of selector, executes callback when selector is present.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n\n        //close proxy\n        phantomProxy.end();\n    });\n    console.log('page now open');\n  });\n\n});\n```\n\n### render(fileName, callbackFn)\nRenders a image of browser.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n      page.render('myimage.png', function(){\n        console.log('saved my picture!');\n\n        //close proxy\n        phantomProxy.end();\n      });\n    });\n    console.log('page now open');\n  });\n\n});\n```\n\n### renderBase64(type, callbackFn)\nReturns a base64 representation of image.\n\n### evaluate(functionToEvaluate, callbackFn, [arg1, arg2,... argN]\nExecutes functionToEvaluate in phantomJS browser.  Once function executes, callbackFn will be invoked with a result parameter. The Third and sebsequent arguments represent optional parameters which will be passed to the functionToEvaluate function when it is invoked in the browser.\n\n## Events\nThe following events are supported, see [PhantomJs Docs](https://github.com/ariya/phantomjs/wiki/API-Reference) for more information.\n\n<table><thead><th>Event Name</th><th>Notes</th></thead>\n<tbody>\n<tr><td>urlChanged</td><td></td></tr>\n<tr><td>resourceReceived</td><td></td></tr>\n<tr><td>resourceRequested</td><td></td></tr>\n<tr><td>prompt</td><td>Event will fire, but callback will not execute in phantomjs context</td></tr>\n<tr><td>pageCreated</td><td></td></tr>\n<tr><td>navigationRequested</td><td></td></tr>\n<tr><td>loadStarted</td><td></td></tr>\n<tr><td>loadFinished</td><td></td></tr>\n<tr><td>initialized</td><td></td></tr>\n<tr><td>error</td><td></td></tr>\n<tr><td>consoleMessage</td><td></td></tr>\n<tr><td>confirm</td><td>Event will fire, but callback will not execute in phantomjs context</td></tr>\n<tr><td>closing</td><td></td></tr>\n<tr><td>callback</td><td></td></tr>\n<tr><td>alert</td><td></td></tr>\n</tbody>\n</table>\n\n\n#### Subscribing to events\n\n```javascript\nphantomProxy = require('phantom-proxy');\nphantomProxy.create({}, function (proxy) {\n    proxy.page.on('urlChanged', function(){\n      console.log('url changed');\n    });\n});\n```\n\n\n\n\n## Revision History\n* 2012-11-06 - version 0.1.6\n - reworked event communication interface - no longer using stdoutput to pass event messages\n - reworked process creation and exit logic \n - startup time and event latency are much improved - should run much faster than before\n* 2012-11-03 - version 0.1.3\n  - added callback parameter to end method on proxy.\n  - removed unref call in proxy\n  - added debug option\n* 2012-10-22 - version 0.1.2\n  - breaking - changed the way events are consumed, switched to using nodes emmitter to brodcast events as opposed to invoking instance methods on the object.  To fix issues, use [object].on('eventname') style syntax.\n  - Code clean up\n* 2012-10-17 - version 0.1.16\n   - fixed waitforSelector issue\n* 2012-10-12  - version 0.1.15\n    - fixed a problem w/ waitforSelector fn.\n    - fixed problem where process wasn't shutting down existing server.\n* version 0.1.13\n  - added args property handling for phantom object\n  - added ability to specify port for rpc channel\n  - added timeout on waitforSelector function\n  - added ability to pass cmd line arguments for phantom via options object\n* version 0.1.10\n  - cleaned up and reorganized code\n  - added unit tests\n  - fixed process related issues\n\n","_id":"phantom-proxy@0.1.71","dist":{"shasum":"0e7b9153dc8a2926c349045ba8ea09682d77d9f9","tarball":"https://registry.npmjs.org/phantom-proxy/-/phantom-proxy-0.1.71.tgz","integrity":"sha512-bzQRs3Nw52OTZnHmxBmiZL987i3JLKtFhHcdBqAr4iLq1vg0w5ELRSHueOAqp6FpJPe8YDx3/tatkPEr/WafhQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC3YDi2FksZUi7xE58p3skqMRNPxOJ+HALXzWkCJ/GfJgIhANAtAMWjfSbFowzW1cWuL4zBRofcReKVA4P/7KZ0WMbf"}]},"_npmVersion":"1.1.62","_npmUser":{"name":"sheebz","email":"rob.schieber@gmail.com"},"maintainers":[{"name":"sheebz","email":"rob.schieber@gmail.com"}]},"0.1.72":{"author":{"name":"Rob Schieber","email":"rob.schieber@gmail.com","url":"https://twitter.com/sheebz"},"bugs":{"mail":"rob.schieber@gmail.com","url":" https://github.com/sheebz/phantom-proxy/issues"},"dependencies":{"colors":"~0.6.0-1","form-data":"~0.0.3","mime":"~1.2.7","q":"~0.8.8","underscore":"~1.4.0","event-stream":"~3.0.7"},"description":"a lightweight proxy that lets you to drive phantomjs from node.","devDependencies":{"cucumber":">0.0.0","mocha":"~1.5.0","should":"~1.2.0","jshint":"latest"},"directories":{"example":"./example","lib":"./lib","test":"./test"},"engines":{"node":">0.6.0"},"keywords":["phantomjs","phantom","cucumber","cucumberjs","feature","testing"],"licenses":[{"type":"MIT","url":"https://github.com/sheebz/phantom-proxy/blob/master/README.md"}],"main":"index.js","name":"phantom-proxy","private":false,"repository":{"type":"git","url":"https://github.com/sheebz/phantom-proxy"},"version":"0.1.72","readme":"# phantom-proxy\n* Allows you to drive [phantomjs](www.phantomjs.org) from [node](www.nodejs.org)\n* Does not rely on alert side effects for communicating with phantomjs\n* Uses Phantom's embedded mongoose web server for communication - more efficient, simpler, faster.\n* Provides a full api - including a parametrized evaluate function - no more hard coded strings\n* Provides additional useful methods such as waitForSelector\n* Can easily integrate with feature testing frameworks such as [cucumber](https://github.com/cucumber/cucumber-js), jasmine, mocha\n\n## Overview\nPhantomJs is an incredibly useful tool for functional and unit testing.  PhantomJs runs in its own process, making it difficult to drive from node.  Phantom-proxy solves this problem, allowing you to fully drive phantomjs from node.\n\n## Installation\n\n`npm install phantom-proxy`\n\n## Usage\n### Examples\nSee the [API](https://github.com/sheebz/phantom-proxy/blob/master/api.md) documentation for more usage information.\n\n#### wait for a specific selector to appear\n```javascript\nvar phantomProxy = require('phantom-proxy');\n\nphantomProxy.create({}, function (proxy) {\n    var page = proxy.page;\n    page.open('http://www.w3.org', function () {\n        page.waitForSelector('body', function () {\n            console.log('body tag present');\n            proxy.end();\n        });\n    });\n\n});\n```\n\n#### render a screenshot\n```javascript\nphantomProxy.create({\"debug\":true}, function (proxy) {\n    proxy.page.open('http://www.w3.org', function (result) {\n        assert.equal(result, true);\n        proxy.page.waitForSelector('body', function (result) {\n            assert.equal(result, true);\n            proxy.page.render('./scratch/scratch.png', function (result) {\n                assert.equal(result, true);\n                proxy.end(function () {\n                  console.log('done');\n                });\n            });\n        }, 1000);\n    });\n});\n            \n```\n\n#### subscribe to events - see api docs for complete list\n```javascript\nphantomProxy.create({\"debug\":true}, function (proxy) {\n    self.proxy.page.on('navigationRequested', function (url) {\n      console.log('at %s', url);\n      \n      if (url === 'http://www.w3.org') {\n        console.log('at w3.org');\n      }\n      else {\n        console.log('how did we get here?');\n      }\n      \n      proxy.end(function () {\n        console.log('done');\n      });\n    });\n    \n    proxy.page.open('http://www.w3.org', function (result) {\n      proxy.page.on('alert', function (msg) {\n          if (msg.trim() === 'hello') {\n              console.log('it said hello');\n          }\n          \n        proxy.end(function () {\n          console.log('done');\n        });\n      });\n\n\n\n    });\n});\n            \n```\n# API Documentation\n## phantomProxy object\n### create([options], callbackFn)\nuse this method to create an instance of the phantom proxy objects.  The return value will be an object with a page proxy and a phantom proxy.  These properties correspond to the phantom and webpage objects on the native phantom API.\n\nWhen this method is called, a new phantomjs process is spawned.  The new phantomjs process creates a mongoose webserver on localhost:1061.  All subsequent communication with phantom occurs via http requests.\n\n#### Options argument (experimental)\nCreate accepts an options object as the first parameter.  This argument is optional.  Properties and their default values are listed below.\n\n```javascript\n\n        var defaultoptions = {\n            'ignoreSslErrors':true,\n            'localToRemoteUrlAccessEnabled':true,\n            'cookiesFile':'cookies.txt',\n            'diskCache':'yes',\n            'loadImages':'yes',\n            'localToRemoteUrlAccess':'no',\n            'maxDiskCache':'50000',\n            'outputEncoding':'utf8',\n            'proxy':'0',\n            'proxyType':'yes',\n            'scriptEncoding':'yes',\n            'webSecurity':'yes',\n            'port':1061\n        };\n```\n\n### end(callbackFn)\nYou should call end on the returned proxy object to ensure that phantomjs is properly shut down.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create(function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  //do some stuff...\n  //...\n  //call end when done\n  proxy.end(function(){\n    console.log('phantom has exited');\n  });\n});\n```\n\n## phantom Object\nThe phantom object corresponds to the phantom object in the native phantomJs API.\n\n## Page Object\nThe page object corresponds to the webpage object in the native phantomJs API.\n\n### set(propertyName, propertyValue, callbackFn)\nsets property on page object\n\n```javascript\n  //set viewport size for browser window\n  proxy.page.set('viewportSize',\n  { width:320, height:480 }, function (result) {\n      console.log(result.toString().cyan);\n      worldCallback.call(self);\n  });\n```\n\n### open(url, callbackFn)\nOpens a webpage with url and callback function arguments.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    console.log('page now open');\n\n    //close proxy\n    phantomProxy.end();\n  });\n\n});\n```\n\n### waitForSelector(selector, callbackFn, timeout)\nPolls page for presence of selector, executes callback when selector is present.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n\n        //close proxy\n        phantomProxy.end();\n    });\n    console.log('page now open');\n  });\n\n});\n```\n\n### render(fileName, callbackFn)\nRenders a image of browser.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n      page.render('myimage.png', function(){\n        console.log('saved my picture!');\n\n        //close proxy\n        phantomProxy.end();\n      });\n    });\n    console.log('page now open');\n  });\n\n});\n```\n\n### renderBase64(type, callbackFn)\nReturns a base64 representation of image.\n\n### evaluate(functionToEvaluate, callbackFn, [arg1, arg2,... argN]\nExecutes functionToEvaluate in phantomJS browser.  Once function executes, callbackFn will be invoked with a result parameter. The Third and sebsequent arguments represent optional parameters which will be passed to the functionToEvaluate function when it is invoked in the browser.\n\n## Events\nThe following events are supported, see [PhantomJs Docs](https://github.com/ariya/phantomjs/wiki/API-Reference) for more information.\n\n<table><thead><th>Event Name</th><th>Notes</th></thead>\n<tbody>\n<tr><td>urlChanged</td><td></td></tr>\n<tr><td>resourceReceived</td><td></td></tr>\n<tr><td>resourceRequested</td><td></td></tr>\n<tr><td>prompt</td><td>Event will fire, but callback will not execute in phantomjs context</td></tr>\n<tr><td>pageCreated</td><td></td></tr>\n<tr><td>navigationRequested</td><td></td></tr>\n<tr><td>loadStarted</td><td></td></tr>\n<tr><td>loadFinished</td><td></td></tr>\n<tr><td>initialized</td><td></td></tr>\n<tr><td>error</td><td></td></tr>\n<tr><td>consoleMessage</td><td></td></tr>\n<tr><td>confirm</td><td>Event will fire, but callback will not execute in phantomjs context</td></tr>\n<tr><td>closing</td><td></td></tr>\n<tr><td>callback</td><td></td></tr>\n<tr><td>alert</td><td></td></tr>\n</tbody>\n</table>\n\n\n#### Subscribing to events\n\n```javascript\nphantomProxy = require('phantom-proxy');\nphantomProxy.create({}, function (proxy) {\n    proxy.page.on('urlChanged', function(){\n      console.log('url changed');\n    });\n});\n```\n\n\n\n\n## Revision History\n* 2012-11-06 - version 0.1.6\n - reworked event communication interface - no longer using stdoutput to pass event messages\n - reworked process creation and exit logic \n - startup time and event latency are much improved - should run much faster than before\n* 2012-11-03 - version 0.1.3\n  - added callback parameter to end method on proxy.\n  - removed unref call in proxy\n  - added debug option\n* 2012-10-22 - version 0.1.2\n  - breaking - changed the way events are consumed, switched to using nodes emmitter to brodcast events as opposed to invoking instance methods on the object.  To fix issues, use [object].on('eventname') style syntax.\n  - Code clean up\n* 2012-10-17 - version 0.1.16\n   - fixed waitforSelector issue\n* 2012-10-12  - version 0.1.15\n    - fixed a problem w/ waitforSelector fn.\n    - fixed problem where process wasn't shutting down existing server.\n* version 0.1.13\n  - added args property handling for phantom object\n  - added ability to specify port for rpc channel\n  - added timeout on waitforSelector function\n  - added ability to pass cmd line arguments for phantom via options object\n* version 0.1.10\n  - cleaned up and reorganized code\n  - added unit tests\n  - fixed process related issues\n\n","_id":"phantom-proxy@0.1.72","dist":{"shasum":"bae267e03b6b4d9a9af59c7f1d58dee1a576971d","tarball":"https://registry.npmjs.org/phantom-proxy/-/phantom-proxy-0.1.72.tgz","integrity":"sha512-l+3OQ2BZjVfbUAC5W3NopXbkpHrHdUKomXDC0Wsi/avBxHvUC38dFDQ0JfXqKK0T2j11p6z6XP9bXm4ywuf19Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIH6oPLxCk9eHN5UHEzr8oGeBeqhCY/otAjvXfBDvCaufAiB08nnUUAmAgDm061rbRBxjOxHt4ofwPfrff2Vsiu49Yw=="}]},"_npmVersion":"1.1.62","_npmUser":{"name":"sheebz","email":"rob.schieber@gmail.com"},"maintainers":[{"name":"sheebz","email":"rob.schieber@gmail.com"}]},"0.1.721":{"author":{"name":"Rob Schieber","email":"rob.schieber@gmail.com","url":"https://twitter.com/sheebz"},"bugs":{"mail":"rob.schieber@gmail.com","url":" https://github.com/sheebz/phantom-proxy/issues"},"dependencies":{"colors":"~0.6.0-1","form-data":"~0.0.3","mime":"~1.2.7","q":"~0.8.8","underscore":"~1.4.0","event-stream":"~3.0.7"},"description":"a lightweight proxy that lets you to drive phantomjs from node.","devDependencies":{"cucumber":">0.0.0","mocha":"~1.5.0","should":"~1.2.0","jshint":"latest"},"directories":{"example":"./example","lib":"./lib","test":"./test"},"engines":{"node":">0.6.0"},"keywords":["phantomjs","phantom","cucumber","cucumberjs","feature","testing"],"licenses":[{"type":"MIT","url":"https://github.com/sheebz/phantom-proxy/blob/master/README.md"}],"main":"index.js","name":"phantom-proxy","private":false,"repository":{"type":"git","url":"https://github.com/sheebz/phantom-proxy"},"version":"0.1.721","readme":"# phantom-proxy\n* Allows you to drive [phantomjs](www.phantomjs.org) from [node](www.nodejs.org)\n* Does not rely on alert side effects for communicating with phantomjs\n* Uses Phantom's embedded mongoose web server for communication - more efficient, simpler, faster.\n* Provides a full api - including a parametrized evaluate function - no more hard coded strings\n* Provides additional useful methods such as waitForSelector\n* Can easily integrate with feature testing frameworks such as [cucumber](https://github.com/cucumber/cucumber-js), jasmine, mocha\n\n## Overview\nPhantomJs is an incredibly useful tool for functional and unit testing.  PhantomJs runs in its own process, making it difficult to drive from node.  Phantom-proxy solves this problem, allowing you to fully drive phantomjs from node.\n\n## Installation\n\n`npm install phantom-proxy`\n\n## Usage\n### Examples\nSee the [API](https://github.com/sheebz/phantom-proxy/blob/master/api.md) documentation for more usage information.\n\n#### wait for a specific selector to appear\n```javascript\nvar phantomProxy = require('phantom-proxy');\n\nphantomProxy.create({}, function (proxy) {\n    var page = proxy.page;\n    page.open('http://www.w3.org', function () {\n        page.waitForSelector('body', function () {\n            console.log('body tag present');\n            proxy.end();\n        });\n    });\n\n});\n```\n\n#### render a screenshot\n```javascript\nphantomProxy.create({\"debug\":true}, function (proxy) {\n    proxy.page.open('http://www.w3.org', function (result) {\n        assert.equal(result, true);\n        proxy.page.waitForSelector('body', function (result) {\n            assert.equal(result, true);\n            proxy.page.render('./scratch/scratch.png', function (result) {\n                assert.equal(result, true);\n                proxy.end(function () {\n                  console.log('done');\n                });\n            });\n        }, 1000);\n    });\n});\n            \n```\n\n#### subscribe to events - see api docs for complete list\n```javascript\nphantomProxy.create({\"debug\":true}, function (proxy) {\n    self.proxy.page.on('navigationRequested', function (url) {\n      console.log('at %s', url);\n      \n      if (url === 'http://www.w3.org') {\n        console.log('at w3.org');\n      }\n      else {\n        console.log('how did we get here?');\n      }\n      \n      proxy.end(function () {\n        console.log('done');\n      });\n    });\n    \n    proxy.page.open('http://www.w3.org', function (result) {\n      proxy.page.on('alert', function (msg) {\n          if (msg.trim() === 'hello') {\n              console.log('it said hello');\n          }\n          \n        proxy.end(function () {\n          console.log('done');\n        });\n      });\n\n\n\n    });\n});\n            \n```\n# API Documentation\n## phantomProxy object\n### create([options], callbackFn)\nuse this method to create an instance of the phantom proxy objects.  The return value will be an object with a page proxy and a phantom proxy.  These properties correspond to the phantom and webpage objects on the native phantom API.\n\nWhen this method is called, a new phantomjs process is spawned.  The new phantomjs process creates a mongoose webserver on localhost:1061.  All subsequent communication with phantom occurs via http requests.\n\n#### Options argument (experimental)\nCreate accepts an options object as the first parameter.  This argument is optional.  Properties and their default values are listed below.\n\n```javascript\n\n        var defaultoptions = {\n            'ignoreSslErrors':true,\n            'localToRemoteUrlAccessEnabled':true,\n            'cookiesFile':'cookies.txt',\n            'diskCache':'yes',\n            'loadImages':'yes',\n            'localToRemoteUrlAccess':'no',\n            'maxDiskCache':'50000',\n            'outputEncoding':'utf8',\n            'proxy':'0',\n            'proxyType':'yes',\n            'scriptEncoding':'yes',\n            'webSecurity':'yes',\n            'port':1061\n        };\n```\n\n### end(callbackFn)\nYou should call end on the returned proxy object to ensure that phantomjs is properly shut down.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create(function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  //do some stuff...\n  //...\n  //call end when done\n  proxy.end(function(){\n    console.log('phantom has exited');\n  });\n});\n```\n\n## phantom Object\nThe phantom object corresponds to the phantom object in the native phantomJs API.\n\n## Page Object\nThe page object corresponds to the webpage object in the native phantomJs API.\n\n### set(propertyName, propertyValue, callbackFn)\nsets property on page object\n\n```javascript\n  //set viewport size for browser window\n  proxy.page.set('viewportSize',\n  { width:320, height:480 }, function (result) {\n      console.log(result.toString().cyan);\n      worldCallback.call(self);\n  });\n```\n\n### open(url, callbackFn)\nOpens a webpage with url and callback function arguments.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    console.log('page now open');\n\n    //close proxy\n    phantomProxy.end();\n  });\n\n});\n```\n\n### waitForSelector(selector, callbackFn, timeout)\nPolls page for presence of selector, executes callback when selector is present.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n\n        //close proxy\n        phantomProxy.end();\n    });\n    console.log('page now open');\n  });\n\n});\n```\n\n### render(fileName, callbackFn)\nRenders a image of browser.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n      page.render('myimage.png', function(){\n        console.log('saved my picture!');\n\n        //close proxy\n        phantomProxy.end();\n      });\n    });\n    console.log('page now open');\n  });\n\n});\n```\n\n### renderBase64(type, callbackFn)\nReturns a base64 representation of image.\n\n### evaluate(functionToEvaluate, callbackFn, [arg1, arg2,... argN]\nExecutes functionToEvaluate in phantomJS browser.  Once function executes, callbackFn will be invoked with a result parameter. The Third and sebsequent arguments represent optional parameters which will be passed to the functionToEvaluate function when it is invoked in the browser.\n\n## Events\nThe following events are supported, see [PhantomJs Docs](https://github.com/ariya/phantomjs/wiki/API-Reference) for more information.\n\n<table><thead><th>Event Name</th><th>Notes</th></thead>\n<tbody>\n<tr><td>urlChanged</td><td></td></tr>\n<tr><td>resourceReceived</td><td></td></tr>\n<tr><td>resourceRequested</td><td></td></tr>\n<tr><td>prompt</td><td>Event will fire, but callback will not execute in phantomjs context</td></tr>\n<tr><td>pageCreated</td><td></td></tr>\n<tr><td>navigationRequested</td><td></td></tr>\n<tr><td>loadStarted</td><td></td></tr>\n<tr><td>loadFinished</td><td></td></tr>\n<tr><td>initialized</td><td></td></tr>\n<tr><td>error</td><td></td></tr>\n<tr><td>consoleMessage</td><td></td></tr>\n<tr><td>confirm</td><td>Event will fire, but callback will not execute in phantomjs context</td></tr>\n<tr><td>closing</td><td></td></tr>\n<tr><td>callback</td><td></td></tr>\n<tr><td>alert</td><td></td></tr>\n</tbody>\n</table>\n\n\n#### Subscribing to events\n\n```javascript\nphantomProxy = require('phantom-proxy');\nphantomProxy.create({}, function (proxy) {\n    proxy.page.on('urlChanged', function(){\n      console.log('url changed');\n    });\n});\n```\n\n\n\n\n## Revision History\n* 2012-11-06 - version 0.1.6\n - reworked event communication interface - no longer using stdoutput to pass event messages\n - reworked process creation and exit logic \n - startup time and event latency are much improved - should run much faster than before\n* 2012-11-03 - version 0.1.3\n  - added callback parameter to end method on proxy.\n  - removed unref call in proxy\n  - added debug option\n* 2012-10-22 - version 0.1.2\n  - breaking - changed the way events are consumed, switched to using nodes emmitter to brodcast events as opposed to invoking instance methods on the object.  To fix issues, use [object].on('eventname') style syntax.\n  - Code clean up\n* 2012-10-17 - version 0.1.16\n   - fixed waitforSelector issue\n* 2012-10-12  - version 0.1.15\n    - fixed a problem w/ waitforSelector fn.\n    - fixed problem where process wasn't shutting down existing server.\n* version 0.1.13\n  - added args property handling for phantom object\n  - added ability to specify port for rpc channel\n  - added timeout on waitforSelector function\n  - added ability to pass cmd line arguments for phantom via options object\n* version 0.1.10\n  - cleaned up and reorganized code\n  - added unit tests\n  - fixed process related issues\n\n","_id":"phantom-proxy@0.1.721","dist":{"shasum":"0b167b78be410421052509d7de032b2938d055c5","tarball":"https://registry.npmjs.org/phantom-proxy/-/phantom-proxy-0.1.721.tgz","integrity":"sha512-z1jg1n6klOMRiL/7sYR+yofJm+DnvGBC8BmTE29pZc6syOpmdHuMjhmkWL/0QCNQAUvy+UHozZX96CRrWhx0Ug==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICz4NIpv+zGfJLQSYc/gVoqmH+mxaJV4CJKkoMFukqCwAiEAwvsTreKvPn9333cQheDi+WnWWeCBmtQxNIsH7zNUplk="}]},"_npmVersion":"1.1.62","_npmUser":{"name":"sheebz","email":"rob.schieber@gmail.com"},"maintainers":[{"name":"sheebz","email":"rob.schieber@gmail.com"}]},"0.1.73":{"author":{"name":"Rob Schieber","email":"rob.schieber@gmail.com","url":"https://twitter.com/sheebz"},"bugs":{"mail":"rob.schieber@gmail.com","url":" https://github.com/sheebz/phantom-proxy/issues"},"dependencies":{"colors":"~0.6.0-1","form-data":"~0.0.3","mime":"~1.2.7","q":"~0.8.8","underscore":"~1.4.0","event-stream":"~3.0.7"},"description":"a lightweight proxy that lets you to drive phantomjs from node.","devDependencies":{"cucumber":">0.0.0","mocha":"~1.5.0","should":"~1.2.0","jshint":"latest"},"directories":{"example":"./example","lib":"./lib","test":"./test"},"engines":{"node":">0.6.0"},"keywords":["phantomjs","phantom","cucumber","cucumberjs","feature","testing"],"licenses":[{"type":"MIT","url":"https://github.com/sheebz/phantom-proxy/blob/master/README.md"}],"main":"index.js","name":"phantom-proxy","private":false,"repository":{"type":"git","url":"https://github.com/sheebz/phantom-proxy"},"version":"0.1.73","readme":"# phantom-proxy\n* Allows you to drive [phantomjs](www.phantomjs.org) from [node](www.nodejs.org)\n* Does not rely on alert side effects for communicating with phantomjs\n* Uses Phantom's embedded mongoose web server for communication - more efficient, simpler, faster.\n* Provides a full api - including a parametrized evaluate function - no more hard coded strings\n* Provides additional useful methods such as waitForSelector\n* Can easily integrate with feature testing frameworks such as [cucumber](https://github.com/cucumber/cucumber-js), jasmine, mocha\n\n## Overview\nPhantomJs is an incredibly useful tool for functional and unit testing.  PhantomJs runs in its own process, making it difficult to drive from node.  Phantom-proxy solves this problem, allowing you to fully drive phantomjs from node.\n\n## Installation\n\n`npm install phantom-proxy`\n\n## Usage\n### Examples\nSee the [API](https://github.com/sheebz/phantom-proxy/blob/master/api.md) documentation for more usage information.\n\n#### wait for a specific selector to appear\n```javascript\nvar phantomProxy = require('phantom-proxy');\n\nphantomProxy.create({}, function (proxy) {\n    var page = proxy.page;\n    page.open('http://www.w3.org', function () {\n        page.waitForSelector('body', function () {\n            console.log('body tag present');\n            proxy.end();\n        });\n    });\n\n});\n```\n\n#### render a screenshot\n```javascript\nphantomProxy.create({\"debug\":true}, function (proxy) {\n    proxy.page.open('http://www.w3.org', function (result) {\n        assert.equal(result, true);\n        proxy.page.waitForSelector('body', function (result) {\n            assert.equal(result, true);\n            proxy.page.render('./scratch/scratch.png', function (result) {\n                assert.equal(result, true);\n                proxy.end(function () {\n                  console.log('done');\n                });\n            });\n        }, 1000);\n    });\n});\n            \n```\n\n#### subscribe to events - see api docs for complete list\n```javascript\nphantomProxy.create({\"debug\":true}, function (proxy) {\n    self.proxy.page.on('navigationRequested', function (url) {\n      console.log('at %s', url);\n      \n      if (url === 'http://www.w3.org') {\n        console.log('at w3.org');\n      }\n      else {\n        console.log('how did we get here?');\n      }\n      \n      proxy.end(function () {\n        console.log('done');\n      });\n    });\n    \n    proxy.page.open('http://www.w3.org', function (result) {\n      proxy.page.on('alert', function (msg) {\n          if (msg.trim() === 'hello') {\n              console.log('it said hello');\n          }\n          \n        proxy.end(function () {\n          console.log('done');\n        });\n      });\n\n\n\n    });\n});\n            \n```\n# API Documentation\n## phantomProxy object\n### create([options], callbackFn)\nuse this method to create an instance of the phantom proxy objects.  The return value will be an object with a page proxy and a phantom proxy.  These properties correspond to the phantom and webpage objects on the native phantom API.\n\nWhen this method is called, a new phantomjs process is spawned.  The new phantomjs process creates a mongoose webserver on localhost:1061.  All subsequent communication with phantom occurs via http requests.\n\n#### Options argument (experimental)\nCreate accepts an options object as the first parameter.  This argument is optional.  Properties and their default values are listed below.\n\n```javascript\n\n        var defaultoptions = {\n            'ignoreSslErrors':true,\n            'localToRemoteUrlAccessEnabled':true,\n            'cookiesFile':'cookies.txt',\n            'diskCache':'yes',\n            'loadImages':'yes',\n            'localToRemoteUrlAccess':'no',\n            'maxDiskCache':'50000',\n            'outputEncoding':'utf8',\n            'proxy':'0',\n            'proxyType':'yes',\n            'scriptEncoding':'yes',\n            'webSecurity':'yes',\n            'port':1061\n        };\n```\n\n### end(callbackFn)\nYou should call end on the returned proxy object to ensure that phantomjs is properly shut down.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create(function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  //do some stuff...\n  //...\n  //call end when done\n  proxy.end(function(){\n    console.log('phantom has exited');\n  });\n});\n```\n\n## phantom Object\nThe phantom object corresponds to the phantom object in the native phantomJs API.\n\n## Page Object\nThe page object corresponds to the webpage object in the native phantomJs API.\n\n### set(propertyName, propertyValue, callbackFn)\nsets property on page object\n\n```javascript\n  //set viewport size for browser window\n  proxy.page.set('viewportSize',\n  { width:320, height:480 }, function (result) {\n      console.log(result.toString().cyan);\n      worldCallback.call(self);\n  });\n```\n\n### open(url, callbackFn)\nOpens a webpage with url and callback function arguments.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    console.log('page now open');\n\n    //close proxy\n    phantomProxy.end();\n  });\n\n});\n```\n\n### waitForSelector(selector, callbackFn, timeout)\nPolls page for presence of selector, executes callback when selector is present.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n\n        //close proxy\n        phantomProxy.end();\n    });\n    console.log('page now open');\n  });\n\n});\n```\n\n### render(fileName, callbackFn)\nRenders a image of browser.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n      page.render('myimage.png', function(){\n        console.log('saved my picture!');\n\n        //close proxy\n        phantomProxy.end();\n      });\n    });\n    console.log('page now open');\n  });\n\n});\n```\n\n### renderBase64(type, callbackFn)\nReturns a base64 representation of image.\n\n### evaluate(functionToEvaluate, callbackFn, [arg1, arg2,... argN]\nExecutes functionToEvaluate in phantomJS browser.  Once function executes, callbackFn will be invoked with a result parameter. The Third and sebsequent arguments represent optional parameters which will be passed to the functionToEvaluate function when it is invoked in the browser.\n\n## Events\nThe following events are supported, see [PhantomJs Docs](https://github.com/ariya/phantomjs/wiki/API-Reference) for more information.\n\n<table><thead><th>Event Name</th><th>Notes</th></thead>\n<tbody>\n<tr><td>urlChanged</td><td></td></tr>\n<tr><td>resourceReceived</td><td></td></tr>\n<tr><td>resourceRequested</td><td></td></tr>\n<tr><td>prompt</td><td>Event will fire, but callback will not execute in phantomjs context</td></tr>\n<tr><td>pageCreated</td><td></td></tr>\n<tr><td>navigationRequested</td><td></td></tr>\n<tr><td>loadStarted</td><td></td></tr>\n<tr><td>loadFinished</td><td></td></tr>\n<tr><td>initialized</td><td></td></tr>\n<tr><td>error</td><td></td></tr>\n<tr><td>consoleMessage</td><td></td></tr>\n<tr><td>confirm</td><td>Event will fire, but callback will not execute in phantomjs context</td></tr>\n<tr><td>closing</td><td></td></tr>\n<tr><td>callback</td><td></td></tr>\n<tr><td>alert</td><td></td></tr>\n</tbody>\n</table>\n\n\n#### Subscribing to events\n\n```javascript\nphantomProxy = require('phantom-proxy');\nphantomProxy.create({}, function (proxy) {\n    proxy.page.on('urlChanged', function(){\n      console.log('url changed');\n    });\n});\n```\n\n\n\n\n## Revision History\n* 2012-11-06 - version 0.1.6\n - reworked event communication interface - no longer using stdoutput to pass event messages\n - reworked process creation and exit logic \n - startup time and event latency are much improved - should run much faster than before\n* 2012-11-03 - version 0.1.3\n  - added callback parameter to end method on proxy.\n  - removed unref call in proxy\n  - added debug option\n* 2012-10-22 - version 0.1.2\n  - breaking - changed the way events are consumed, switched to using nodes emmitter to brodcast events as opposed to invoking instance methods on the object.  To fix issues, use [object].on('eventname') style syntax.\n  - Code clean up\n* 2012-10-17 - version 0.1.16\n   - fixed waitforSelector issue\n* 2012-10-12  - version 0.1.15\n    - fixed a problem w/ waitforSelector fn.\n    - fixed problem where process wasn't shutting down existing server.\n* version 0.1.13\n  - added args property handling for phantom object\n  - added ability to specify port for rpc channel\n  - added timeout on waitforSelector function\n  - added ability to pass cmd line arguments for phantom via options object\n* version 0.1.10\n  - cleaned up and reorganized code\n  - added unit tests\n  - fixed process related issues\n\n","_id":"phantom-proxy@0.1.73","dist":{"shasum":"323e238795435afedafe64161560a250703488cd","tarball":"https://registry.npmjs.org/phantom-proxy/-/phantom-proxy-0.1.73.tgz","integrity":"sha512-8LB5/3zdLEF+m5NVrHeA2/BhlE7M+V3+CibKU0/aDIfOJ3qvDkpE+RVWiZgR4j0Q/58Xw0ipPqS6woAsrYT8yA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGWL6sqQfaeoqipsw4uSnWCPW10wSAixLfKETEAWSkLMAiAZQZ78jClgZ43MIcCSH2sxtLDKgzrB2V4ItHw1TggfqA=="}]},"_npmVersion":"1.1.62","_npmUser":{"name":"sheebz","email":"rob.schieber@gmail.com"},"maintainers":[{"name":"sheebz","email":"rob.schieber@gmail.com"}]},"0.1.74":{"author":{"name":"Rob Schieber","email":"rob.schieber@gmail.com","url":"https://twitter.com/sheebz"},"bugs":{"mail":"rob.schieber@gmail.com","url":" https://github.com/sheebz/phantom-proxy/issues"},"dependencies":{"colors":"~0.6.0-1","form-data":"~0.0.3","mime":"~1.2.7","q":"~0.8.8","underscore":"~1.4.0","express":" ~3.0.3","socket.io":"~0.9.11"},"description":"a lightweight proxy that lets you to drive phantomjs from node.","devDependencies":{"cucumber":">0.0.0","mocha":"~1.5.0","should":"~1.2.0","jshint":"latest"},"directories":{"example":"./example","lib":"./lib","test":"./test"},"engines":{"node":">0.6.0"},"keywords":["phantomjs","phantom","cucumber","cucumberjs","feature","testing"],"licenses":[{"type":"MIT","url":"https://github.com/sheebz/phantom-proxy/blob/master/README.md"}],"main":"index.js","name":"phantom-proxy","private":false,"repository":{"type":"git","url":"https://github.com/sheebz/phantom-proxy"},"version":"0.1.74","readme":"# phantom-proxy\n* Allows you to drive [phantomjs](www.phantomjs.org) from [node](www.nodejs.org)\n* Does not rely on alert side effects for communicating with phantomjs\n* Uses Phantom's embedded mongoose web server for communication - more efficient, simpler, faster.\n* Provides a full api - including a parametrized evaluate function - no more hard coded strings\n* Provides additional useful methods such as waitForSelector\n* Can easily integrate with feature testing frameworks such as [cucumber](https://github.com/cucumber/cucumber-js), jasmine, mocha\n\n## Overview\nPhantomJs is an incredibly useful tool for functional and unit testing.  PhantomJs runs in its own process, making it difficult to drive from node.  Phantom-proxy solves this problem, allowing you to fully drive phantomjs from node.\n\n## Installation\n\n`npm install phantom-proxy`\n\n## Usage\n### Examples\nSee the [API](https://github.com/sheebz/phantom-proxy/blob/master/api.md) documentation for more usage information.\n\n#### wait for a specific selector to appear\n```javascript\nvar phantomProxy = require('phantom-proxy');\n\nphantomProxy.create({}, function (proxy) {\n    var page = proxy.page;\n    page.open('http://www.w3.org', function () {\n        page.waitForSelector('body', function () {\n            console.log('body tag present');\n            proxy.end();\n        });\n    });\n\n});\n```\n\n#### render a screenshot\n```javascript\nphantomProxy.create({\"debug\":true}, function (proxy) {\n    proxy.page.open('http://www.w3.org', function (result) {\n        assert.equal(result, true);\n        proxy.page.waitForSelector('body', function (result) {\n            assert.equal(result, true);\n            proxy.page.render('./scratch/scratch.png', function (result) {\n                assert.equal(result, true);\n                proxy.end(function () {\n                  console.log('done');\n                });\n            });\n        }, 1000);\n    });\n});\n\n```\n\n#### subscribe to events - see api docs for complete list\n```javascript\nphantomProxy.create({\"debug\":true}, function (proxy) {\n    self.proxy.page.on('navigationRequested', function (url) {\n      console.log('at %s', url);\n\n      if (url === 'http://www.w3.org') {\n        console.log('at w3.org');\n      }\n      else {\n        console.log('how did we get here?');\n      }\n\n      proxy.end(function () {\n        console.log('done');\n      });\n    });\n\n    proxy.page.open('http://www.w3.org', function (result) {\n      proxy.page.on('alert', function (msg) {\n          if (msg.trim() === 'hello') {\n              console.log('it said hello');\n          }\n\n        proxy.end(function () {\n          console.log('done');\n        });\n      });\n\n\n\n    });\n});\n\n```\n# API Documentation\n## phantomProxy object\n### create([options], callbackFn)\nuse this method to create an instance of the phantom proxy objects.  The return value will be an object with a page proxy and a phantom proxy.  These properties correspond to the phantom and webpage objects on the native phantom API.\n\nWhen this method is called, a new phantomjs process is spawned.  The new phantomjs process creates a mongoose webserver on localhost:1061.  All subsequent communication with phantom occurs via http requests.\n\n#### Options argument (experimental)\nCreate accepts an options object as the first parameter.  This argument is optional.  Properties and their default values are listed below.\n\n```javascript\n\n        var defaultoptions = {\n            'ignoreSslErrors':true,\n            'localToRemoteUrlAccessEnabled':true,\n            'cookiesFile':'cookies.txt',\n            'diskCache':'yes',\n            'loadImages':'yes',\n            'localToRemoteUrlAccess':'no',\n            'maxDiskCache':'50000',\n            'outputEncoding':'utf8',\n            'proxy':'0',\n            'proxyType':'yes',\n            'scriptEncoding':'yes',\n            'webSecurity':'yes',\n            'port':1061\n        };\n```\n\n### end(callbackFn)\nYou should call end on the returned proxy object to ensure that phantomjs is properly shut down.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create(function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  //do some stuff...\n  //...\n  //call end when done\n  proxy.end(function(){\n    console.log('phantom has exited');\n  });\n});\n```\n\n## phantom Object\nThe phantom object corresponds to the phantom object in the native phantomJs API.\n\n## Page Object\nThe page object corresponds to the webpage object in the native phantomJs API.\n\n### set(propertyName, propertyValue, callbackFn)\nsets property on page object\n\n```javascript\n  //set viewport size for browser window\n  proxy.page.set('viewportSize',\n  { width:320, height:480 }, function (result) {\n      console.log(result.toString().cyan);\n      worldCallback.call(self);\n  });\n```\n\n### open(url, callbackFn)\nOpens a webpage with url and callback function arguments.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    console.log('page now open');\n\n    //close proxy\n    phantomProxy.end();\n  });\n\n});\n```\n\n### waitForSelector(selector, callbackFn, timeout)\nPolls page for presence of selector, executes callback when selector is present.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n\n        //close proxy\n        phantomProxy.end();\n    });\n    console.log('page now open');\n  });\n\n});\n```\n\n### render(fileName, callbackFn)\nRenders a image of browser.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n      page.render('myimage.png', function(){\n        console.log('saved my picture!');\n\n        //close proxy\n        phantomProxy.end();\n      });\n    });\n    console.log('page now open');\n  });\n\n});\n```\n\n### renderBase64(type, callbackFn)\nReturns a base64 representation of image.\n\n### evaluate(functionToEvaluate, callbackFn, [arg1, arg2,... argN]\nExecutes functionToEvaluate in phantomJS browser.  Once function executes, callbackFn will be invoked with a result parameter. The Third and sebsequent arguments represent optional parameters which will be passed to the functionToEvaluate function when it is invoked in the browser.\n\n## Events\nThe following events are supported, see [PhantomJs Docs](https://github.com/ariya/phantomjs/wiki/API-Reference) for more information.\n\n<table><thead><th>Event Name</th><th>Notes</th></thead>\n<tbody>\n<tr><td>urlChanged</td><td></td></tr>\n<tr><td>resourceReceived</td><td></td></tr>\n<tr><td>resourceRequested</td><td></td></tr>\n<tr><td>prompt</td><td>Event will fire, but callback will not execute in phantomjs context</td></tr>\n<tr><td>pageCreated</td><td></td></tr>\n<tr><td>navigationRequested</td><td></td></tr>\n<tr><td>loadStarted</td><td></td></tr>\n<tr><td>loadFinished</td><td></td></tr>\n<tr><td>initialized</td><td></td></tr>\n<tr><td>error</td><td></td></tr>\n<tr><td>consoleMessage</td><td></td></tr>\n<tr><td>confirm</td><td>Event will fire, but callback will not execute in phantomjs context</td></tr>\n<tr><td>closing</td><td></td></tr>\n<tr><td>callback</td><td></td></tr>\n<tr><td>alert</td><td></td></tr>\n</tbody>\n</table>\n\n\n#### Subscribing to events\n\n```javascript\nphantomProxy = require('phantom-proxy');\nphantomProxy.create({}, function (proxy) {\n    proxy.page.on('urlChanged', function(){\n      console.log('url changed');\n    });\n});\n```\n\n\n\n\n## Revision History\n* 2012-11-06 - version 0.1.6\n - reworked event communication interface to use socket.io - no longer using filesyste to pass event messages, should help with dropped msgs\n* 2012-11-06 - version 0.1.6\n - reworked event communication interface - no longer using stdoutput to pass event messages\n - reworked process creation and exit logic\n - startup time and event latency are much improved - should run much faster than before\n* 2012-11-03 - version 0.1.3\n  - added callback parameter to end method on proxy.\n  - removed unref call in proxy\n  - added debug option\n* 2012-10-22 - version 0.1.2\n  - breaking - changed the way events are consumed, switched to using nodes emmitter to brodcast events as opposed to invoking instance methods on the object.  To fix issues, use [object].on('eventname') style syntax.\n  - Code clean up\n* 2012-10-17 - version 0.1.16\n   - fixed waitforSelector issue\n* 2012-10-12  - version 0.1.15\n    - fixed a problem w/ waitforSelector fn.\n    - fixed problem where process wasn't shutting down existing server.\n* version 0.1.13\n  - added args property handling for phantom object\n  - added ability to specify port for rpc channel\n  - added timeout on waitforSelector function\n  - added ability to pass cmd line arguments for phantom via options object\n* version 0.1.10\n  - cleaned up and reorganized code\n  - added unit tests\n  - fixed process related issues\n\n","readmeFilename":"README.md","_id":"phantom-proxy@0.1.74","dist":{"shasum":"dfeeae71a7fcd969baafefb7dff8183e980f806e","tarball":"https://registry.npmjs.org/phantom-proxy/-/phantom-proxy-0.1.74.tgz","integrity":"sha512-PqAcDTF+y3rrV/HKAWUe8QL+ZKIXT5N06uULFYcSmV8h7RA1T+vf4Do6p7SjHtpq2O2wcTrRZP5e1LA+cAH8lA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEy+zzD0PmLjsm0prMo99/kTRt6frtAZBWipp7OqZDzcAiAzpQt4Q42yxOeCN8t8ti3u2Qn5ONWLFNFoqfTRnO7l9A=="}]},"_npmVersion":"1.1.65","_npmUser":{"name":"sheebz","email":"rob.schieber@gmail.com"},"maintainers":[{"name":"sheebz","email":"rob.schieber@gmail.com"}]},"0.1.75":{"author":{"name":"Rob Schieber","email":"rob.schieber@gmail.com","url":"https://twitter.com/sheebz"},"bugs":{"mail":"rob.schieber@gmail.com","url":" https://github.com/sheebz/phantom-proxy/issues"},"dependencies":{"colors":"~0.6.0-1","form-data":"~0.0.3","mime":"~1.2.7","q":"~0.8.8","underscore":"~1.4.0","express":" ~3.0.3","socket.io":"~0.9.11"},"description":"a lightweight proxy that lets you to drive phantomjs from node.","devDependencies":{"cucumber":">0.0.0","mocha":"~1.5.0","should":"~1.2.0","jshint":"latest"},"directories":{"example":"./example","lib":"./lib","test":"./test"},"engines":{"node":">0.6.0"},"keywords":["phantomjs","phantom","cucumber","cucumberjs","feature","testing"],"licenses":[{"type":"MIT","url":"https://github.com/sheebz/phantom-proxy/blob/master/README.md"}],"main":"index.js","name":"phantom-proxy","private":false,"repository":{"type":"git","url":"https://github.com/sheebz/phantom-proxy"},"version":"0.1.75","readme":"# phantom-proxy\n* Allows you to drive [phantomjs](www.phantomjs.org) from [node](www.nodejs.org)\n* Does not rely on alert side effects for communicating with phantomjs\n* Uses Phantom's embedded mongoose web server for communication - more efficient, simpler, faster.\n* Provides a full api - including a parametrized evaluate function - no more hard coded strings\n* Provides additional useful methods such as waitForSelector\n* Can easily integrate with feature testing frameworks such as [cucumber](https://github.com/cucumber/cucumber-js), jasmine, mocha\n\n## Overview\nPhantomJs is an incredibly useful tool for functional and unit testing.  PhantomJs runs in its own process, making it difficult to drive from node.  Phantom-proxy solves this problem, allowing you to fully drive phantomjs from node.\n\n## Installation\n\n`npm install phantom-proxy`\n\n## Usage\n### Examples\nSee the [API](https://github.com/sheebz/phantom-proxy/blob/master/api.md) documentation for more usage information.\n\n#### wait for a specific selector to appear\n```javascript\nvar phantomProxy = require('phantom-proxy');\n\nphantomProxy.create({}, function (proxy) {\n    var page = proxy.page;\n    page.open('http://www.w3.org', function () {\n        page.waitForSelector('body', function () {\n            console.log('body tag present');\n            proxy.end();\n        });\n    });\n\n});\n```\n\n#### render a screenshot\n```javascript\nphantomProxy.create({\"debug\":true}, function (proxy) {\n    proxy.page.open('http://www.w3.org', function (result) {\n        assert.equal(result, true);\n        proxy.page.waitForSelector('body', function (result) {\n            assert.equal(result, true);\n            proxy.page.render('./scratch/scratch.png', function (result) {\n                assert.equal(result, true);\n                proxy.end(function () {\n                  console.log('done');\n                });\n            });\n        }, 1000);\n    });\n});\n\n```\n\n#### subscribe to events - see api docs for complete list\n```javascript\nphantomProxy.create({\"debug\":true}, function (proxy) {\n    self.proxy.page.on('navigationRequested', function (url) {\n      console.log('at %s', url);\n\n      if (url === 'http://www.w3.org') {\n        console.log('at w3.org');\n      }\n      else {\n        console.log('how did we get here?');\n      }\n\n      proxy.end(function () {\n        console.log('done');\n      });\n    });\n\n    proxy.page.open('http://www.w3.org', function (result) {\n      proxy.page.on('alert', function (msg) {\n          if (msg.trim() === 'hello') {\n              console.log('it said hello');\n          }\n\n        proxy.end(function () {\n          console.log('done');\n        });\n      });\n\n\n\n    });\n});\n\n```\n# API Documentation\n## phantomProxy object\n### create([options], callbackFn)\nuse this method to create an instance of the phantom proxy objects.  The return value will be an object with a page proxy and a phantom proxy.  These properties correspond to the phantom and webpage objects on the native phantom API.\n\nWhen this method is called, a new phantomjs process is spawned.  The new phantomjs process creates a mongoose webserver on localhost:1061.  All subsequent communication with phantom occurs via http requests.\n\n#### Options argument (experimental)\nCreate accepts an options object as the first parameter.  This argument is optional.  Properties and their default values are listed below.\n\n```javascript\n\n        var defaultoptions = {\n            'ignoreSslErrors':true,\n            'localToRemoteUrlAccessEnabled':true,\n            'cookiesFile':'cookies.txt',\n            'diskCache':'yes',\n            'loadImages':'yes',\n            'localToRemoteUrlAccess':'no',\n            'maxDiskCache':'50000',\n            'outputEncoding':'utf8',\n            'proxy':'0',\n            'proxyType':'yes',\n            'scriptEncoding':'yes',\n            'webSecurity':'yes',\n            'port':1061\n        };\n```\n\n### end(callbackFn)\nYou should call end on the returned proxy object to ensure that phantomjs is properly shut down.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create(function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  //do some stuff...\n  //...\n  //call end when done\n  proxy.end(function(){\n    console.log('phantom has exited');\n  });\n});\n```\n\n## phantom Object\nThe phantom object corresponds to the phantom object in the native phantomJs API.\n\n## Page Object\nThe page object corresponds to the webpage object in the native phantomJs API.\n\n### set(propertyName, propertyValue, callbackFn)\nsets property on page object\n\n```javascript\n  //set viewport size for browser window\n  proxy.page.set('viewportSize',\n  { width:320, height:480 }, function (result) {\n      console.log(result.toString().cyan);\n      worldCallback.call(self);\n  });\n```\n\n### open(url, callbackFn)\nOpens a webpage with url and callback function arguments.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    console.log('page now open');\n\n    //close proxy\n    phantomProxy.end();\n  });\n\n});\n```\n\n### waitForSelector(selector, callbackFn, timeout)\nPolls page for presence of selector, executes callback when selector is present.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n\n        //close proxy\n        phantomProxy.end();\n    });\n    console.log('page now open');\n  });\n\n});\n```\n\n### render(fileName, callbackFn)\nRenders a image of browser.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n      page.render('myimage.png', function(){\n        console.log('saved my picture!');\n\n        //close proxy\n        phantomProxy.end();\n      });\n    });\n    console.log('page now open');\n  });\n\n});\n```\n\n### renderBase64(type, callbackFn)\nReturns a base64 representation of image.\n\n### evaluate(functionToEvaluate, callbackFn, [arg1, arg2,... argN]\nExecutes functionToEvaluate in phantomJS browser.  Once function executes, callbackFn will be invoked with a result parameter. The Third and sebsequent arguments represent optional parameters which will be passed to the functionToEvaluate function when it is invoked in the browser.\n\n## Events\nThe following events are supported, see [PhantomJs Docs](https://github.com/ariya/phantomjs/wiki/API-Reference) for more information.\n\n<table><thead><th>Event Name</th><th>Notes</th></thead>\n<tbody>\n<tr><td>urlChanged</td><td></td></tr>\n<tr><td>resourceReceived</td><td></td></tr>\n<tr><td>resourceRequested</td><td></td></tr>\n<tr><td>prompt</td><td>Event will fire, but callback will not execute in phantomjs context</td></tr>\n<tr><td>pageCreated</td><td></td></tr>\n<tr><td>navigationRequested</td><td></td></tr>\n<tr><td>loadStarted</td><td></td></tr>\n<tr><td>loadFinished</td><td></td></tr>\n<tr><td>initialized</td><td></td></tr>\n<tr><td>error</td><td></td></tr>\n<tr><td>consoleMessage</td><td></td></tr>\n<tr><td>confirm</td><td>Event will fire, but callback will not execute in phantomjs context</td></tr>\n<tr><td>closing</td><td></td></tr>\n<tr><td>callback</td><td></td></tr>\n<tr><td>alert</td><td></td></tr>\n</tbody>\n</table>\n\n\n#### Subscribing to events\n\n```javascript\nphantomProxy = require('phantom-proxy');\nphantomProxy.create({}, function (proxy) {\n    proxy.page.on('urlChanged', function(){\n      console.log('url changed');\n    });\n});\n```\n\n\n\n\n## Revision History\n* 2012-11-06 - version 0.1.6\n - reworked event communication interface to use socket.io - no longer using filesyste to pass event messages, should help with dropped msgs\n* 2012-11-06 - version 0.1.6\n - reworked event communication interface - no longer using stdoutput to pass event messages\n - reworked process creation and exit logic\n - startup time and event latency are much improved - should run much faster than before\n* 2012-11-03 - version 0.1.3\n  - added callback parameter to end method on proxy.\n  - removed unref call in proxy\n  - added debug option\n* 2012-10-22 - version 0.1.2\n  - breaking - changed the way events are consumed, switched to using nodes emmitter to brodcast events as opposed to invoking instance methods on the object.  To fix issues, use [object].on('eventname') style syntax.\n  - Code clean up\n* 2012-10-17 - version 0.1.16\n   - fixed waitforSelector issue\n* 2012-10-12  - version 0.1.15\n    - fixed a problem w/ waitforSelector fn.\n    - fixed problem where process wasn't shutting down existing server.\n* version 0.1.13\n  - added args property handling for phantom object\n  - added ability to specify port for rpc channel\n  - added timeout on waitforSelector function\n  - added ability to pass cmd line arguments for phantom via options object\n* version 0.1.10\n  - cleaned up and reorganized code\n  - added unit tests\n  - fixed process related issues\n\n","readmeFilename":"README.md","_id":"phantom-proxy@0.1.75","dist":{"shasum":"4796845b74baed1175e0ade0cd31c7d25c1e9abe","tarball":"https://registry.npmjs.org/phantom-proxy/-/phantom-proxy-0.1.75.tgz","integrity":"sha512-PAxRjGoQpU7QqMvoR2uj3egqmgMbIwKFmY+ELzu8hD/8cJ+qgLAUVjcK9M1/XR6juSVgntIOZ8IXpAEiE5kO/Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBrJJT0VxhU5NKtE+VxSGl+vQQOEEvfjdKhVPYIudrnHAiBhJBvFS+1AiWhB5mipwW23JjQcT1rv/OV7fUA1vvBIHQ=="}]},"_npmVersion":"1.1.65","_npmUser":{"name":"sheebz","email":"rob.schieber@gmail.com"},"maintainers":[{"name":"sheebz","email":"rob.schieber@gmail.com"}]},"0.1.76":{"author":{"name":"Rob Schieber","email":"rob.schieber@gmail.com","url":"https://twitter.com/sheebz"},"bugs":{"mail":"rob.schieber@gmail.com","url":" https://github.com/sheebz/phantom-proxy/issues"},"dependencies":{"colors":"~0.6.0-1","form-data":"~0.0.3","mime":"~1.2.7","q":"~0.8.8","underscore":"~1.4.0","express":" ~3.0.3","socket.io":"~0.9.11","event-stream":"~3.0.10"},"description":"a lightweight proxy that lets you to drive phantomjs from node.","devDependencies":{"cucumber":">0.0.0","mocha":"~1.5.0","should":"~1.2.0","jshint":"latest"},"directories":{"example":"./example","lib":"./lib","test":"./test"},"engines":{"node":">0.6.0"},"keywords":["phantomjs","phantom","cucumber","cucumberjs","feature","testing"],"licenses":[{"type":"MIT","url":"https://github.com/sheebz/phantom-proxy/blob/master/README.md"}],"main":"index.js","name":"phantom-proxy","private":false,"repository":{"type":"git","url":"https://github.com/sheebz/phantom-proxy"},"version":"0.1.76","readme":"# phantom-proxy\n* Allows you to drive [phantomjs](www.phantomjs.org) from [node](www.nodejs.org)\n* Does not rely on alert side effects for communicating with phantomjs\n* Uses Phantom's embedded mongoose web server for communication - more efficient, simpler, faster.\n* Provides a full api - including a parametrized evaluate function - no more hard coded strings\n* Provides additional useful methods such as waitForSelector\n* Can easily integrate with feature testing frameworks such as [cucumber](https://github.com/cucumber/cucumber-js), jasmine, mocha\n\n## Overview\nPhantomJs is an incredibly useful tool for functional and unit testing.  PhantomJs runs in its own process, making it difficult to drive from node.  Phantom-proxy solves this problem, allowing you to fully drive phantomjs from node.\n\n## Installation\n\n`npm install phantom-proxy`\n\n## Usage\n### Examples\nSee the [API](https://github.com/sheebz/phantom-proxy/blob/master/api.md) documentation for more usage information.\n\n#### wait for a specific selector to appear\n```javascript\nvar phantomProxy = require('phantom-proxy');\n\nphantomProxy.create({}, function (proxy) {\n    var page = proxy.page;\n    page.open('http://www.w3.org', function () {\n        page.waitForSelector('body', function () {\n            console.log('body tag present');\n            proxy.end();\n        });\n    });\n\n});\n```\n\n#### render a screenshot\n```javascript\nphantomProxy.create({\"debug\":true}, function (proxy) {\n    proxy.page.open('http://www.w3.org', function (result) {\n        assert.equal(result, true);\n        proxy.page.waitForSelector('body', function (result) {\n            assert.equal(result, true);\n            proxy.page.render('./scratch/scratch.png', function (result) {\n                assert.equal(result, true);\n                proxy.end(function () {\n                  console.log('done');\n                });\n            });\n        }, 1000);\n    });\n});\n\n```\n\n#### subscribe to events - see api docs for complete list\n```javascript\nphantomProxy.create({\"debug\":true}, function (proxy) {\n    self.proxy.page.on('navigationRequested', function (url) {\n      console.log('at %s', url);\n\n      if (url === 'http://www.w3.org') {\n        console.log('at w3.org');\n      }\n      else {\n        console.log('how did we get here?');\n      }\n\n      proxy.end(function () {\n        console.log('done');\n      });\n    });\n\n    proxy.page.open('http://www.w3.org', function (result) {\n      proxy.page.on('alert', function (msg) {\n          if (msg.trim() === 'hello') {\n              console.log('it said hello');\n          }\n\n        proxy.end(function () {\n          console.log('done');\n        });\n      });\n\n\n\n    });\n});\n\n```\n# API Documentation\n## phantomProxy object\n### create([options], callbackFn)\nuse this method to create an instance of the phantom proxy objects.  The return value will be an object with a page proxy and a phantom proxy.  These properties correspond to the phantom and webpage objects on the native phantom API.\n\nWhen this method is called, a new phantomjs process is spawned.  The new phantomjs process creates a mongoose webserver on localhost:1061.  All subsequent communication with phantom occurs via http requests.\n\n#### Options argument (experimental)\nCreate accepts an options object as the first parameter.  This argument is optional.  Properties and their default values are listed below.\n\n```javascript\n\n        var defaultoptions = {\n            'ignoreSslErrors':true,\n            'localToRemoteUrlAccessEnabled':true,\n            'cookiesFile':'cookies.txt',\n            'diskCache':'yes',\n            'loadImages':'yes',\n            'localToRemoteUrlAccess':'no',\n            'maxDiskCache':'50000',\n            'outputEncoding':'utf8',\n            'proxy':'0',\n            'proxyType':'yes',\n            'scriptEncoding':'yes',\n            'webSecurity':'yes',\n            'port':1061\n        };\n```\n\n### end(callbackFn)\nYou should call end on the returned proxy object to ensure that phantomjs is properly shut down.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create(function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  //do some stuff...\n  //...\n  //call end when done\n  proxy.end(function(){\n    console.log('phantom has exited');\n  });\n});\n```\n\n## phantom Object\nThe phantom object corresponds to the phantom object in the native phantomJs API.\n\n## Page Object\nThe page object corresponds to the webpage object in the native phantomJs API.\n\n### set(propertyName, propertyValue, callbackFn)\nsets property on page object\n\n```javascript\n  //set viewport size for browser window\n  proxy.page.set('viewportSize',\n  { width:320, height:480 }, function (result) {\n      console.log(result.toString().cyan);\n      worldCallback.call(self);\n  });\n```\n\n### open(url, callbackFn)\nOpens a webpage with url and callback function arguments.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    console.log('page now open');\n\n    //close proxy\n    phantomProxy.end();\n  });\n\n});\n```\n\n### waitForSelector(selector, callbackFn, timeout)\nPolls page for presence of selector, executes callback when selector is present.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n\n        //close proxy\n        phantomProxy.end();\n    });\n    console.log('page now open');\n  });\n\n});\n```\n\n### render(fileName, callbackFn)\nRenders a image of browser.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n      page.render('myimage.png', function(){\n        console.log('saved my picture!');\n\n        //close proxy\n        phantomProxy.end();\n      });\n    });\n    console.log('page now open');\n  });\n\n});\n```\n\n### renderBase64(type, callbackFn)\nReturns a base64 representation of image.\n\n### evaluate(functionToEvaluate, callbackFn, [arg1, arg2,... argN]\nExecutes functionToEvaluate in phantomJS browser.  Once function executes, callbackFn will be invoked with a result parameter. The Third and sebsequent arguments represent optional parameters which will be passed to the functionToEvaluate function when it is invoked in the browser.\n\n## Events\nThe following events are supported, see [PhantomJs Docs](https://github.com/ariya/phantomjs/wiki/API-Reference) for more information.\n\n<table><thead><th>Event Name</th><th>Notes</th></thead>\n<tbody>\n<tr><td>urlChanged</td><td></td></tr>\n<tr><td>resourceReceived</td><td></td></tr>\n<tr><td>resourceRequested</td><td></td></tr>\n<tr><td>prompt</td><td>Event will fire, but callback will not execute in phantomjs context</td></tr>\n<tr><td>pageCreated</td><td></td></tr>\n<tr><td>navigationRequested</td><td></td></tr>\n<tr><td>loadStarted</td><td></td></tr>\n<tr><td>loadFinished</td><td></td></tr>\n<tr><td>initialized</td><td></td></tr>\n<tr><td>error</td><td></td></tr>\n<tr><td>consoleMessage</td><td></td></tr>\n<tr><td>confirm</td><td>Event will fire, but callback will not execute in phantomjs context</td></tr>\n<tr><td>closing</td><td></td></tr>\n<tr><td>callback</td><td></td></tr>\n<tr><td>alert</td><td></td></tr>\n</tbody>\n</table>\n\n\n#### Subscribing to events\n\n```javascript\nphantomProxy = require('phantom-proxy');\nphantomProxy.create({}, function (proxy) {\n    proxy.page.on('urlChanged', function(){\n      console.log('url changed');\n    });\n});\n```\n\n\n\n\n## Revision History\n* 2012-11-06 - version 0.1.6\n - reworked event communication interface to use socket.io - no longer using filesyste to pass event messages, should help with dropped msgs\n* 2012-11-06 - version 0.1.6\n - reworked event communication interface - no longer using stdoutput to pass event messages\n - reworked process creation and exit logic\n - startup time and event latency are much improved - should run much faster than before\n* 2012-11-03 - version 0.1.3\n  - added callback parameter to end method on proxy.\n  - removed unref call in proxy\n  - added debug option\n* 2012-10-22 - version 0.1.2\n  - breaking - changed the way events are consumed, switched to using nodes emmitter to brodcast events as opposed to invoking instance methods on the object.  To fix issues, use [object].on('eventname') style syntax.\n  - Code clean up\n* 2012-10-17 - version 0.1.16\n   - fixed waitforSelector issue\n* 2012-10-12  - version 0.1.15\n    - fixed a problem w/ waitforSelector fn.\n    - fixed problem where process wasn't shutting down existing server.\n* version 0.1.13\n  - added args property handling for phantom object\n  - added ability to specify port for rpc channel\n  - added timeout on waitforSelector function\n  - added ability to pass cmd line arguments for phantom via options object\n* version 0.1.10\n  - cleaned up and reorganized code\n  - added unit tests\n  - fixed process related issues\n\n","readmeFilename":"README.md","_id":"phantom-proxy@0.1.76","dist":{"shasum":"8b213a6af77b0796baf374fd62ef8250769e83b9","tarball":"https://registry.npmjs.org/phantom-proxy/-/phantom-proxy-0.1.76.tgz","integrity":"sha512-wp/v9H/Sxx5MYapNQ3QT4l1o7CY/YlgetQMU7Ul0zmEMe1Q/o3snr8ThhhonumcHE93F1rSy3e4DOtQH7hQyww==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIF+JlzaFA4DpSGHGBe2JBiYW1Ir6dFh+aEQHgv80GFOrAiAVC7FYFdwR7zU2FnGDF3YBqSDcDfZexjmEpOw4/emMjw=="}]},"_npmVersion":"1.1.65","_npmUser":{"name":"sheebz","email":"rob.schieber@gmail.com"},"maintainers":[{"name":"sheebz","email":"rob.schieber@gmail.com"}]},"0.1.77":{"author":{"name":"Rob Schieber","email":"rob.schieber@gmail.com","url":"https://twitter.com/sheebz"},"bugs":{"mail":"rob.schieber@gmail.com","url":" https://github.com/sheebz/phantom-proxy/issues"},"dependencies":{"colors":"~0.6.0-1","form-data":"~0.0.3","mime":"~1.2.7","q":"~0.8.8","underscore":"~1.4.0","express":" ~3.0.3","socket.io":"~0.9.11","event-stream":"~3.0.10"},"description":"a lightweight proxy that lets you to drive phantomjs from node.","devDependencies":{"cucumber":">0.0.0","mocha":"~1.5.0","should":"~1.2.0","jshint":"latest"},"directories":{"example":"./example","lib":"./lib","test":"./test"},"engines":{"node":">0.6.0"},"keywords":["phantomjs","phantom","cucumber","cucumberjs","feature","testing"],"licenses":[{"type":"MIT","url":"https://github.com/sheebz/phantom-proxy/blob/master/README.md"}],"main":"index.js","name":"phantom-proxy","private":false,"repository":{"type":"git","url":"https://github.com/sheebz/phantom-proxy"},"version":"0.1.77","readme":"# phantom-proxy\n* Allows you to drive [phantomjs](www.phantomjs.org) from [node](www.nodejs.org)\n* Does not rely on alert side effects for communicating with phantomjs\n* Uses Phantom's embedded mongoose web server for communication - more efficient, simpler, faster.\n* Provides a full api - including a parametrized evaluate function - no more hard coded strings\n* Provides additional useful methods such as waitForSelector\n* Can easily integrate with feature testing frameworks such as [cucumber](https://github.com/cucumber/cucumber-js), jasmine, mocha\n\n## Overview\nPhantomJs is an incredibly useful tool for functional and unit testing.  PhantomJs runs in its own process, making it difficult to drive from node.  Phantom-proxy solves this problem, allowing you to fully drive phantomjs from node.\n\n## Installation\n\n`npm install phantom-proxy`\n\n## Usage\n### Examples\nSee the [API](https://github.com/sheebz/phantom-proxy/blob/master/api.md) documentation for more usage information.\n\n#### wait for a specific selector to appear\n```javascript\nvar phantomProxy = require('phantom-proxy');\n\nphantomProxy.create({}, function (proxy) {\n    var page = proxy.page;\n    page.open('http://www.w3.org', function () {\n        page.waitForSelector('body', function () {\n            console.log('body tag present');\n            proxy.end();\n        });\n    });\n\n});\n```\n\n#### render a screenshot\n```javascript\nphantomProxy.create({\"debug\":true}, function (proxy) {\n    proxy.page.open('http://www.w3.org', function (result) {\n        assert.equal(result, true);\n        proxy.page.waitForSelector('body', function (result) {\n            assert.equal(result, true);\n            proxy.page.render('./scratch/scratch.png', function (result) {\n                assert.equal(result, true);\n                proxy.end(function () {\n                  console.log('done');\n                });\n            });\n        }, 1000);\n    });\n});\n\n```\n\n#### subscribe to events - see api docs for complete list\n```javascript\nphantomProxy.create({\"debug\":true}, function (proxy) {\n    self.proxy.page.on('navigationRequested', function (url) {\n      console.log('at %s', url);\n\n      if (url === 'http://www.w3.org') {\n        console.log('at w3.org');\n      }\n      else {\n        console.log('how did we get here?');\n      }\n\n      proxy.end(function () {\n        console.log('done');\n      });\n    });\n\n    proxy.page.open('http://www.w3.org', function (result) {\n      proxy.page.on('alert', function (msg) {\n          if (msg.trim() === 'hello') {\n              console.log('it said hello');\n          }\n\n        proxy.end(function () {\n          console.log('done');\n        });\n      });\n\n\n\n    });\n});\n\n```\n# API Documentation\n## phantomProxy object\n### create([options], callbackFn)\nuse this method to create an instance of the phantom proxy objects.  The return value will be an object with a page proxy and a phantom proxy.  These properties correspond to the phantom and webpage objects on the native phantom API.\n\nWhen this method is called, a new phantomjs process is spawned.  The new phantomjs process creates a mongoose webserver on localhost:1061.  All subsequent communication with phantom occurs via http requests.\n\n#### Options argument (experimental)\nCreate accepts an options object as the first parameter.  This argument is optional.  Properties and their default values are listed below.\n\n```javascript\n\n        var defaultoptions = {\n            'ignoreSslErrors':true,\n            'localToRemoteUrlAccessEnabled':true,\n            'cookiesFile':'cookies.txt',\n            'diskCache':'yes',\n            'loadImages':'yes',\n            'localToRemoteUrlAccess':'no',\n            'maxDiskCache':'50000',\n            'outputEncoding':'utf8',\n            'proxy':'0',\n            'proxyType':'yes',\n            'scriptEncoding':'yes',\n            'webSecurity':'yes',\n            'port':1061\n        };\n```\n\n### end(callbackFn)\nYou should call end on the returned proxy object to ensure that phantomjs is properly shut down.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create(function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  //do some stuff...\n  //...\n  //call end when done\n  proxy.end(function(){\n    console.log('phantom has exited');\n  });\n});\n```\n\n## phantom Object\nThe phantom object corresponds to the phantom object in the native phantomJs API.\n\n## Page Object\nThe page object corresponds to the webpage object in the native phantomJs API.\n\n### set(propertyName, propertyValue, callbackFn)\nsets property on page object\n\n```javascript\n  //set viewport size for browser window\n  proxy.page.set('viewportSize',\n  { width:320, height:480 }, function (result) {\n      console.log(result.toString().cyan);\n      worldCallback.call(self);\n  });\n```\n\n### open(url, callbackFn)\nOpens a webpage with url and callback function arguments.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    console.log('page now open');\n\n    //close proxy\n    phantomProxy.end();\n  });\n\n});\n```\n\n### waitForSelector(selector, callbackFn, timeout)\nPolls page for presence of selector, executes callback when selector is present.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n\n        //close proxy\n        phantomProxy.end();\n    });\n    console.log('page now open');\n  });\n\n});\n```\n\n### render(fileName, callbackFn)\nRenders a image of browser.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n      page.render('myimage.png', function(){\n        console.log('saved my picture!');\n\n        //close proxy\n        phantomProxy.end();\n      });\n    });\n    console.log('page now open');\n  });\n\n});\n```\n\n### renderBase64(type, callbackFn)\nReturns a base64 representation of image.\n\n### evaluate(functionToEvaluate, callbackFn, [arg1, arg2,... argN]\nExecutes functionToEvaluate in phantomJS browser.  Once function executes, callbackFn will be invoked with a result parameter. The Third and sebsequent arguments represent optional parameters which will be passed to the functionToEvaluate function when it is invoked in the browser.\n\n## Events\nThe following events are supported, see [PhantomJs Docs](https://github.com/ariya/phantomjs/wiki/API-Reference) for more information.\n\n<table><thead><th>Event Name</th><th>Notes</th></thead>\n<tbody>\n<tr><td>urlChanged</td><td></td></tr>\n<tr><td>resourceReceived</td><td></td></tr>\n<tr><td>resourceRequested</td><td></td></tr>\n<tr><td>prompt</td><td>Event will fire, but callback will not execute in phantomjs context</td></tr>\n<tr><td>pageCreated</td><td></td></tr>\n<tr><td>navigationRequested</td><td></td></tr>\n<tr><td>loadStarted</td><td></td></tr>\n<tr><td>loadFinished</td><td></td></tr>\n<tr><td>initialized</td><td></td></tr>\n<tr><td>error</td><td></td></tr>\n<tr><td>consoleMessage</td><td></td></tr>\n<tr><td>confirm</td><td>Event will fire, but callback will not execute in phantomjs context</td></tr>\n<tr><td>closing</td><td></td></tr>\n<tr><td>callback</td><td></td></tr>\n<tr><td>alert</td><td></td></tr>\n</tbody>\n</table>\n\n\n#### Subscribing to events\n\n```javascript\nphantomProxy = require('phantom-proxy');\nphantomProxy.create({}, function (proxy) {\n    proxy.page.on('urlChanged', function(){\n      console.log('url changed');\n    });\n});\n```\n\n\n\n\n## Revision History\n* 2012-11-06 - version 0.1.6\n - reworked event communication interface to use socket.io - no longer using filesyste to pass event messages, should help with dropped msgs\n* 2012-11-06 - version 0.1.6\n - reworked event communication interface - no longer using stdoutput to pass event messages\n - reworked process creation and exit logic\n - startup time and event latency are much improved - should run much faster than before\n* 2012-11-03 - version 0.1.3\n  - added callback parameter to end method on proxy.\n  - removed unref call in proxy\n  - added debug option\n* 2012-10-22 - version 0.1.2\n  - breaking - changed the way events are consumed, switched to using nodes emmitter to brodcast events as opposed to invoking instance methods on the object.  To fix issues, use [object].on('eventname') style syntax.\n  - Code clean up\n* 2012-10-17 - version 0.1.16\n   - fixed waitforSelector issue\n* 2012-10-12  - version 0.1.15\n    - fixed a problem w/ waitforSelector fn.\n    - fixed problem where process wasn't shutting down existing server.\n* version 0.1.13\n  - added args property handling for phantom object\n  - added ability to specify port for rpc channel\n  - added timeout on waitforSelector function\n  - added ability to pass cmd line arguments for phantom via options object\n* version 0.1.10\n  - cleaned up and reorganized code\n  - added unit tests\n  - fixed process related issues\n\n","readmeFilename":"README.md","_id":"phantom-proxy@0.1.77","dist":{"shasum":"86352288eac26ea69ea2c645ef25329bb4932680","tarball":"https://registry.npmjs.org/phantom-proxy/-/phantom-proxy-0.1.77.tgz","integrity":"sha512-nCDPTdtay/qauWHLcW042CXoqnBPGwWn3jMi1A4zOUPzzM1hUkKdciRmdDqZkXW1lb0QsIv17gow5EnH0pMBcQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDiP92q2MnVwcJB2sx0O2mUcwDXPQwpuhOTasEdO98DNAIgZY7J9NU0gf9+DA9TJuituaqp1qMoZZ0o5s3JA1P8e6U="}]},"_npmVersion":"1.1.65","_npmUser":{"name":"sheebz","email":"rob.schieber@gmail.com"},"maintainers":[{"name":"sheebz","email":"rob.schieber@gmail.com"}]},"0.1.78":{"author":{"name":"Rob Schieber","email":"rob.schieber@gmail.com","url":"https://twitter.com/sheebz"},"bugs":{"mail":"rob.schieber@gmail.com","url":" https://github.com/sheebz/phantom-proxy/issues"},"dependencies":{"colors":"~0.6.0-1","form-data":"~0.0.3","mime":"~1.2.7","q":"~0.8.8","underscore":"~1.4.0","express":" ~3.0.3","socket.io":"~0.9.11","event-stream":"~3.0.10"},"description":"a lightweight proxy that lets you to drive phantomjs from node.","devDependencies":{"cucumber":">0.0.0","mocha":"~1.5.0","should":"~1.2.0","jshint":"latest"},"directories":{"example":"./example","lib":"./lib","test":"./test"},"engines":{"node":">0.6.0"},"keywords":["phantomjs","phantom","cucumber","cucumberjs","feature","testing"],"licenses":[{"type":"MIT","url":"https://github.com/sheebz/phantom-proxy/blob/master/README.md"}],"main":"index.js","name":"phantom-proxy","private":false,"repository":{"type":"git","url":"https://github.com/sheebz/phantom-proxy"},"version":"0.1.78","readme":"# phantom-proxy\n* Allows you to drive [phantomjs](www.phantomjs.org) from [node](www.nodejs.org)\n* Does not rely on alert side effects for communicating with phantomjs\n* Uses Phantom's embedded mongoose web server for communication - more efficient, simpler, faster.\n* Provides a full api - including a parametrized evaluate function - no more hard coded strings\n* Provides additional useful methods such as waitForSelector\n* Can easily integrate with feature testing frameworks such as [cucumber](https://github.com/cucumber/cucumber-js), jasmine, mocha\n\n## Overview\nPhantomJs is an incredibly useful tool for functional and unit testing.  PhantomJs runs in its own process, making it difficult to drive from node.  Phantom-proxy solves this problem, allowing you to fully drive phantomjs from node.\n\n## Installation\n\n`npm install phantom-proxy`\n\n## Usage\n### Examples\nSee the [API](https://github.com/sheebz/phantom-proxy/blob/master/api.md) documentation for more usage information.\n\n#### wait for a specific selector to appear\n```javascript\nvar phantomProxy = require('phantom-proxy');\n\nphantomProxy.create({}, function (proxy) {\n    var page = proxy.page;\n    page.open('http://www.w3.org', function () {\n        page.waitForSelector('body', function () {\n            console.log('body tag present');\n            proxy.end();\n        });\n    });\n\n});\n```\n\n#### render a screenshot\n```javascript\nphantomProxy.create({\"debug\":true}, function (proxy) {\n    proxy.page.open('http://www.w3.org', function (result) {\n        assert.equal(result, true);\n        proxy.page.waitForSelector('body', function (result) {\n            assert.equal(result, true);\n            proxy.page.render('./scratch/scratch.png', function (result) {\n                assert.equal(result, true);\n                proxy.end(function () {\n                  console.log('done');\n                });\n            });\n        }, 1000);\n    });\n});\n\n```\n\n#### subscribe to events - see api docs for complete list\n```javascript\nphantomProxy.create({\"debug\":true}, function (proxy) {\n    self.proxy.page.on('navigationRequested', function (url) {\n      console.log('at %s', url);\n\n      if (url === 'http://www.w3.org') {\n        console.log('at w3.org');\n      }\n      else {\n        console.log('how did we get here?');\n      }\n\n      proxy.end(function () {\n        console.log('done');\n      });\n    });\n\n    proxy.page.open('http://www.w3.org', function (result) {\n      proxy.page.on('alert', function (msg) {\n          if (msg.trim() === 'hello') {\n              console.log('it said hello');\n          }\n\n        proxy.end(function () {\n          console.log('done');\n        });\n      });\n\n\n\n    });\n});\n\n```\n# API Documentation\n## phantomProxy object\n### create([options], callbackFn)\nuse this method to create an instance of the phantom proxy objects.  The return value will be an object with a page proxy and a phantom proxy.  These properties correspond to the phantom and webpage objects on the native phantom API.\n\nWhen this method is called, a new phantomjs process is spawned.  The new phantomjs process creates a mongoose webserver on localhost:1061.  All subsequent communication with phantom occurs via http requests.\n\n#### Options argument (experimental)\nCreate accepts an options object as the first parameter.  This argument is optional.  Properties and their default values are listed below.\n\n```javascript\n\n        var defaultoptions = {\n            'ignoreSslErrors':true,\n            'localToRemoteUrlAccessEnabled':true,\n            'cookiesFile':'cookies.txt',\n            'diskCache':'yes',\n            'loadImages':'yes',\n            'localToRemoteUrlAccess':'no',\n            'maxDiskCache':'50000',\n            'outputEncoding':'utf8',\n            'proxy':'0',\n            'proxyType':'yes',\n            'scriptEncoding':'yes',\n            'webSecurity':'yes',\n            'port':1061\n        };\n```\n\n### end(callbackFn)\nYou should call end on the returned proxy object to ensure that phantomjs is properly shut down.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create(function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  //do some stuff...\n  //...\n  //call end when done\n  proxy.end(function(){\n    console.log('phantom has exited');\n  });\n});\n```\n\n## phantom Object\nThe phantom object corresponds to the phantom object in the native phantomJs API.\n\n## Page Object\nThe page object corresponds to the webpage object in the native phantomJs API.\n\n### set(propertyName, propertyValue, callbackFn)\nsets property on page object\n\n```javascript\n  //set viewport size for browser window\n  proxy.page.set('viewportSize',\n  { width:320, height:480 }, function (result) {\n      console.log(result.toString().cyan);\n      worldCallback.call(self);\n  });\n```\n\n### open(url, callbackFn)\nOpens a webpage with url and callback function arguments.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    console.log('page now open');\n\n    //close proxy\n    phantomProxy.end();\n  });\n\n});\n```\n\n### waitForSelector(selector, callbackFn, timeout)\nPolls page for presence of selector, executes callback when selector is present.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n\n        //close proxy\n        phantomProxy.end();\n    });\n    console.log('page now open');\n  });\n\n});\n```\n\n### render(fileName, callbackFn)\nRenders a image of browser.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n      page.render('myimage.png', function(){\n        console.log('saved my picture!');\n\n        //close proxy\n        phantomProxy.end();\n      });\n    });\n    console.log('page now open');\n  });\n\n});\n```\n\n### renderBase64(type, callbackFn)\nReturns a base64 representation of image.\n\n### evaluate(functionToEvaluate, callbackFn, [arg1, arg2,... argN]\nExecutes functionToEvaluate in phantomJS browser.  Once function executes, callbackFn will be invoked with a result parameter. The Third and sebsequent arguments represent optional parameters which will be passed to the functionToEvaluate function when it is invoked in the browser.\n\n## Events\nThe following events are supported, see [PhantomJs Docs](https://github.com/ariya/phantomjs/wiki/API-Reference) for more information.\n\n<table><thead><th>Event Name</th><th>Notes</th></thead>\n<tbody>\n<tr><td>urlChanged</td><td></td></tr>\n<tr><td>resourceReceived</td><td></td></tr>\n<tr><td>resourceRequested</td><td></td></tr>\n<tr><td>prompt</td><td>Event will fire, but callback will not execute in phantomjs context</td></tr>\n<tr><td>pageCreated</td><td></td></tr>\n<tr><td>navigationRequested</td><td></td></tr>\n<tr><td>loadStarted</td><td></td></tr>\n<tr><td>loadFinished</td><td></td></tr>\n<tr><td>initialized</td><td></td></tr>\n<tr><td>error</td><td></td></tr>\n<tr><td>consoleMessage</td><td></td></tr>\n<tr><td>confirm</td><td>Event will fire, but callback will not execute in phantomjs context</td></tr>\n<tr><td>closing</td><td></td></tr>\n<tr><td>callback</td><td></td></tr>\n<tr><td>alert</td><td></td></tr>\n</tbody>\n</table>\n\n\n#### Subscribing to events\n\n```javascript\nphantomProxy = require('phantom-proxy');\nphantomProxy.create({}, function (proxy) {\n    proxy.page.on('urlChanged', function(){\n      console.log('url changed');\n    });\n});\n```\n\n\n\n\n## Revision History\n* 2012-11-06 - version 0.1.6\n - reworked event communication interface to use socket.io - no longer using filesyste to pass event messages, should help with dropped msgs\n* 2012-11-06 - version 0.1.6\n - reworked event communication interface - no longer using stdoutput to pass event messages\n - reworked process creation and exit logic\n - startup time and event latency are much improved - should run much faster than before\n* 2012-11-03 - version 0.1.3\n  - added callback parameter to end method on proxy.\n  - removed unref call in proxy\n  - added debug option\n* 2012-10-22 - version 0.1.2\n  - breaking - changed the way events are consumed, switched to using nodes emmitter to brodcast events as opposed to invoking instance methods on the object.  To fix issues, use [object].on('eventname') style syntax.\n  - Code clean up\n* 2012-10-17 - version 0.1.16\n   - fixed waitforSelector issue\n* 2012-10-12  - version 0.1.15\n    - fixed a problem w/ waitforSelector fn.\n    - fixed problem where process wasn't shutting down existing server.\n* version 0.1.13\n  - added args property handling for phantom object\n  - added ability to specify port for rpc channel\n  - added timeout on waitforSelector function\n  - added ability to pass cmd line arguments for phantom via options object\n* version 0.1.10\n  - cleaned up and reorganized code\n  - added unit tests\n  - fixed process related issues\n\n","readmeFilename":"README.md","_id":"phantom-proxy@0.1.78","dist":{"shasum":"19e7503ece9079fe51b901a4281fcee101602f57","tarball":"https://registry.npmjs.org/phantom-proxy/-/phantom-proxy-0.1.78.tgz","integrity":"sha512-PBqgQi5G8B/VDsOu3+t7I1gz9ucvvygzmxq1p9lk/lGGvLNwlsKXDz82js2lO+riipN3gqPP0gpE08n67JuBUQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDaNwI2A3Y3TZhnyU8F778fffPBzGHsKNtpcsmImAKtrwIgB0nbKv3bFacfUaLi2xf7cNz7HCGyVJDS/GWSdv04vsg="}]},"_npmVersion":"1.1.65","_npmUser":{"name":"sheebz","email":"rob.schieber@gmail.com"},"maintainers":[{"name":"sheebz","email":"rob.schieber@gmail.com"}]},"0.1.79":{"author":{"name":"Rob Schieber","email":"rob.schieber@gmail.com","url":"https://twitter.com/sheebz"},"bugs":{"mail":"rob.schieber@gmail.com","url":" https://github.com/sheebz/phantom-proxy/issues"},"dependencies":{"colors":"~0.6.0-1","form-data":"~0.0.3","mime":"~1.2.7","q":"~0.8.8","underscore":"~1.4.0","express":" ~3.0.3","socket.io":"~0.9.11","event-stream":"~3.0.10"},"description":"a lightweight proxy that lets you to drive phantomjs from node.","devDependencies":{"cucumber":">0.0.0","mocha":"~1.5.0","should":"~1.2.0","jshint":"latest"},"directories":{"example":"./example","lib":"./lib","test":"./test"},"engines":{"node":">0.6.0"},"keywords":["phantomjs","phantom","cucumber","cucumberjs","feature","testing"],"licenses":[{"type":"MIT","url":"https://github.com/sheebz/phantom-proxy/blob/master/README.md"}],"main":"index.js","name":"phantom-proxy","private":false,"repository":{"type":"git","url":"https://github.com/sheebz/phantom-proxy"},"version":"0.1.79","readme":"# phantom-proxy\n* Allows you to drive [phantomjs](www.phantomjs.org) from [node](www.nodejs.org)\n* Does not rely on alert side effects for communicating with phantomjs\n* Uses Phantom's embedded mongoose web server for communication - more efficient, simpler, faster.\n* Provides a full api - including a parametrized evaluate function - no more hard coded strings\n* Provides additional useful methods such as waitForSelector\n* Can easily integrate with feature testing frameworks such as [cucumber](https://github.com/cucumber/cucumber-js), jasmine, mocha\n\n## Overview\nPhantomJs is an incredibly useful tool for functional and unit testing.  PhantomJs runs in its own process, making it difficult to drive from node.  Phantom-proxy solves this problem, allowing you to fully drive phantomjs from node.\n\n## Installation\n\n`npm install phantom-proxy`\n\n## Usage\n### Examples\nSee the [API](https://github.com/sheebz/phantom-proxy/blob/master/api.md) documentation for more usage information.\n\n#### wait for a specific selector to appear\n```javascript\nvar phantomProxy = require('phantom-proxy');\n\nphantomProxy.create({}, function (proxy) {\n    var page = proxy.page;\n    page.open('http://www.w3.org', function () {\n        page.waitForSelector('body', function () {\n            console.log('body tag present');\n            proxy.end();\n        });\n    });\n\n});\n```\n\n#### render a screenshot\n```javascript\nphantomProxy.create({\"debug\":true}, function (proxy) {\n    proxy.page.open('http://www.w3.org', function (result) {\n        assert.equal(result, true);\n        proxy.page.waitForSelector('body', function (result) {\n            assert.equal(result, true);\n            proxy.page.render('./scratch/scratch.png', function (result) {\n                assert.equal(result, true);\n                proxy.end(function () {\n                  console.log('done');\n                });\n            });\n        }, 1000);\n    });\n});\n\n```\n\n#### subscribe to events - see api docs for complete list\n```javascript\nphantomProxy.create({\"debug\":true}, function (proxy) {\n    self.proxy.page.on('navigationRequested', function (url) {\n      console.log('at %s', url);\n\n      if (url === 'http://www.w3.org') {\n        console.log('at w3.org');\n      }\n      else {\n        console.log('how did we get here?');\n      }\n\n      proxy.end(function () {\n        console.log('done');\n      });\n    });\n\n    proxy.page.open('http://www.w3.org', function (result) {\n      proxy.page.on('alert', function (msg) {\n          if (msg.trim() === 'hello') {\n              console.log('it said hello');\n          }\n\n        proxy.end(function () {\n          console.log('done');\n        });\n      });\n\n\n\n    });\n});\n\n```\n# API Documentation\n## phantomProxy object\n### create([options], callbackFn)\nuse this method to create an instance of the phantom proxy objects.  The return value will be an object with a page proxy and a phantom proxy.  These properties correspond to the phantom and webpage objects on the native phantom API.\n\nWhen this method is called, a new phantomjs process is spawned.  The new phantomjs process creates a mongoose webserver on localhost:1061.  All subsequent communication with phantom occurs via http requests.\n\n#### Options argument (experimental)\nCreate accepts an options object as the first parameter.  This argument is optional.  Properties and their default values are listed below.\n\n```javascript\n\n        var defaultoptions = {\n            'ignoreSslErrors':true,\n            'localToRemoteUrlAccessEnabled':true,\n            'cookiesFile':'cookies.txt',\n            'diskCache':'yes',\n            'loadImages':'yes',\n            'localToRemoteUrlAccess':'no',\n            'maxDiskCache':'50000',\n            'outputEncoding':'utf8',\n            'proxy':'0',\n            'proxyType':'yes',\n            'scriptEncoding':'yes',\n            'webSecurity':'yes',\n            'port':1061\n        };\n```\n\n### end(callbackFn)\nYou should call end on the returned proxy object to ensure that phantomjs is properly shut down.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create(function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  //do some stuff...\n  //...\n  //call end when done\n  proxy.end(function(){\n    console.log('phantom has exited');\n  });\n});\n```\n\n## phantom Object\nThe phantom object corresponds to the phantom object in the native phantomJs API.\n\n## Page Object\nThe page object corresponds to the webpage object in the native phantomJs API.\n\n### set(propertyName, propertyValue, callbackFn)\nsets setting on page object\n\n```javascript\n  proxy.page.set('userAgent', 'iPad', function (result) {\n      console.log(result.toString());\n  });\n```\n\n### get(propertyName, callbackFn)\ngets a setting on page object\n\n```javascript\n  proxy.page.get('userAgent', function (result) {\n      console.log(result.toString());\n  });\n```\n\n### open(url, callbackFn)\nOpens a webpage with url and callback function arguments.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    console.log('page now open');\n\n    //close proxy\n    phantomProxy.end();\n  });\n\n});\n```\n\n### waitForSelector(selector, callbackFn, timeout)\nPolls page for presence of selector, executes callback when selector is present.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n\n        //close proxy\n        phantomProxy.end();\n    });\n    console.log('page now open');\n  });\n\n});\n```\n\n### render(fileName, callbackFn)\nRenders a image of browser.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n      page.render('myimage.png', function(){\n        console.log('saved my picture!');\n\n        //close proxy\n        phantomProxy.end();\n      });\n    });\n    console.log('page now open');\n  });\n\n});\n```\n\n### renderBase64(type, callbackFn)\nReturns a base64 representation of image.\n\n### evaluate(functionToEvaluate, callbackFn, [arg1, arg2,... argN]\nExecutes functionToEvaluate in phantomJS browser.  Once function executes, callbackFn will be invoked with a result parameter. The Third and sebsequent arguments represent optional parameters which will be passed to the functionToEvaluate function when it is invoked in the browser.\n\n## Events\nThe following events are supported, see [PhantomJs Docs](https://github.com/ariya/phantomjs/wiki/API-Reference) for more information.\n\n<table><thead><th>Event Name</th><th>Notes</th></thead>\n<tbody>\n<tr><td>urlChanged</td><td></td></tr>\n<tr><td>resourceReceived</td><td></td></tr>\n<tr><td>resourceRequested</td><td></td></tr>\n<tr><td>prompt</td><td>Event will fire, but callback will not execute in phantomjs context</td></tr>\n<tr><td>pageCreated</td><td></td></tr>\n<tr><td>navigationRequested</td><td></td></tr>\n<tr><td>loadStarted</td><td></td></tr>\n<tr><td>loadFinished</td><td></td></tr>\n<tr><td>initialized</td><td></td></tr>\n<tr><td>error</td><td></td></tr>\n<tr><td>consoleMessage</td><td></td></tr>\n<tr><td>confirm</td><td>See onConfirmCallback for handling this event</td></tr>\n<tr><td>closing</td><td></td></tr>\n<tr><td>callback</td><td></td></tr>\n<tr><td>alert</td><td></td></tr>\n</tbody>\n</table>\n\n\n#### Subscribing to events\n\n```javascript\nphantomProxy = require('phantom-proxy');\nphantomProxy.create({}, function (proxy) {\n    proxy.page.on('urlChanged', function(){\n      console.log('url changed');\n    });\n});\n```\n\n#### Special events\n\nSome phantomjs functions allow you to return a value to drive phantom interaction. Currently, onConfirm is supported. To register a callback function for intercepting confirm dialogs, use onConfirmCallback:\n\n```javascript\n// return true corresponds to accepting confirm, return false is denying\nproxy.page.set('onConfirmCallback', function(msg) { return true; });\n```\n\nPre-registering a confirm function can be useful if you encounter a page that prompts you when you try to leave. Without registering a function that returns true, phantomjs will hang. Please note you can still listen for the 'confirm' event in conjunction with this special handler.\n\n## Revision History\n* 2012-11-06 - version 0.1.6\n - reworked event communication interface to use socket.io - no longer using filesyste to pass event messages, should help with dropped msgs\n* 2012-11-06 - version 0.1.6\n - reworked event communication interface - no longer using stdoutput to pass event messages\n - reworked process creation and exit logic\n - startup time and event latency are much improved - should run much faster than before\n* 2012-11-03 - version 0.1.3\n  - added callback parameter to end method on proxy.\n  - removed unref call in proxy\n  - added debug option\n* 2012-10-22 - version 0.1.2\n  - breaking - changed the way events are consumed, switched to using nodes emmitter to brodcast events as opposed to invoking instance methods on the object.  To fix issues, use [object].on('eventname') style syntax.\n  - Code clean up\n* 2012-10-17 - version 0.1.16\n   - fixed waitforSelector issue\n* 2012-10-12  - version 0.1.15\n    - fixed a problem w/ waitforSelector fn.\n    - fixed problem where process wasn't shutting down existing server.\n* version 0.1.13\n  - added args property handling for phantom object\n  - added ability to specify port for rpc channel\n  - added timeout on waitforSelector function\n  - added ability to pass cmd line arguments for phantom via options object\n* version 0.1.10\n  - cleaned up and reorganized code\n  - added unit tests\n  - fixed process related issues\n\n","readmeFilename":"README.md","_id":"phantom-proxy@0.1.79","dist":{"shasum":"841227538cd396680c8bc83fb86d5058206258c2","tarball":"https://registry.npmjs.org/phantom-proxy/-/phantom-proxy-0.1.79.tgz","integrity":"sha512-jUnEUmwk7Fh2O1EcVDN0jPYGNhf8vPDDQUgy7/kIqVwMFCsXCt39pJh/mk8ZEC33sTBC6ekLrnVDI2/5V/BPDQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFeYIu6Dx98Dw2RI9jfzZzhqsDrxJPi7pMv0idu/f+1VAiEAxGkCOPtETIf6we23YbGVdGie6qrgPNakkAmUFxdPKTw="}]},"_npmVersion":"1.1.65","_npmUser":{"name":"sheebz","email":"rob.schieber@gmail.com"},"maintainers":[{"name":"sheebz","email":"rob.schieber@gmail.com"}]},"0.1.791":{"author":{"name":"Rob Schieber","email":"rob.schieber@gmail.com","url":"https://twitter.com/sheebz"},"bugs":{"mail":"rob.schieber@gmail.com","url":" https://github.com/sheebz/phantom-proxy/issues"},"dependencies":{"colors":"~0.6.0-1","form-data":"~0.0.3","mime":"~1.2.7","q":"~0.8.8","underscore":"~1.4.0","express":" ~3.0.3","socket.io":"~0.9.11","event-stream":"~3.0.10"},"description":"a lightweight proxy that lets you to drive phantomjs from node.","devDependencies":{"cucumber":">0.0.0","mocha":"~1.5.0","should":"~1.2.0","jshint":"latest"},"directories":{"example":"./example","lib":"./lib","test":"./test"},"engines":{"node":">0.6.0"},"keywords":["phantomjs","phantom","cucumber","cucumberjs","feature","testing"],"licenses":[{"type":"MIT","url":"https://github.com/sheebz/phantom-proxy/blob/master/README.md"}],"main":"index.js","name":"phantom-proxy","private":false,"repository":{"type":"git","url":"https://github.com/sheebz/phantom-proxy"},"version":"0.1.791","readme":"# phantom-proxy\n* Allows you to drive [phantomjs](www.phantomjs.org) from [node](www.nodejs.org)\n* Does not rely on alert side effects for communicating with phantomjs\n* Uses Phantom's embedded mongoose web server for communication - more efficient, simpler, faster.\n* Provides a full api - including a parametrized evaluate function - no more hard coded strings\n* Provides additional useful methods such as waitForSelector\n* Can easily integrate with feature testing frameworks such as [cucumber](https://github.com/cucumber/cucumber-js), jasmine, mocha\n\n## Overview\nPhantomJs is an incredibly useful tool for functional and unit testing.  PhantomJs runs in its own process, making it difficult to drive from node.  Phantom-proxy solves this problem, allowing you to fully drive phantomjs from node.\n\n## Installation\n\n`npm install phantom-proxy`\n\n## Usage\n### Examples\nSee the [API](https://github.com/sheebz/phantom-proxy/blob/master/api.md) documentation for more usage information.\n\n#### wait for a specific selector to appear\n```javascript\nvar phantomProxy = require('phantom-proxy');\n\nphantomProxy.create({}, function (proxy) {\n    var page = proxy.page;\n    page.open('http://www.w3.org', function () {\n        page.waitForSelector('body', function () {\n            console.log('body tag present');\n            proxy.end();\n        });\n    });\n\n});\n```\n\n#### render a screenshot\n```javascript\nphantomProxy.create({\"debug\":true}, function (proxy) {\n    proxy.page.open('http://www.w3.org', function (result) {\n        assert.equal(result, true);\n        proxy.page.waitForSelector('body', function (result) {\n            assert.equal(result, true);\n            proxy.page.render('./scratch/scratch.png', function (result) {\n                assert.equal(result, true);\n                proxy.end(function () {\n                  console.log('done');\n                });\n            });\n        }, 1000);\n    });\n});\n\n```\n\n#### subscribe to events - see api docs for complete list\n```javascript\nphantomProxy.create({\"debug\":true}, function (proxy) {\n    self.proxy.page.on('navigationRequested', function (url) {\n      console.log('at %s', url);\n\n      if (url === 'http://www.w3.org') {\n        console.log('at w3.org');\n      }\n      else {\n        console.log('how did we get here?');\n      }\n\n      proxy.end(function () {\n        console.log('done');\n      });\n    });\n\n    proxy.page.open('http://www.w3.org', function (result) {\n      proxy.page.on('alert', function (msg) {\n          if (msg.trim() === 'hello') {\n              console.log('it said hello');\n          }\n\n        proxy.end(function () {\n          console.log('done');\n        });\n      });\n\n\n\n    });\n});\n\n```\n# API Documentation\n## phantomProxy object\n### create([options], callbackFn)\nuse this method to create an instance of the phantom proxy objects.  The return value will be an object with a page proxy and a phantom proxy.  These properties correspond to the phantom and webpage objects on the native phantom API.\n\nWhen this method is called, a new phantomjs process is spawned.  The new phantomjs process creates a mongoose webserver on localhost:1061.  All subsequent communication with phantom occurs via http requests.\n\n#### Options argument (experimental)\nCreate accepts an options object as the first parameter.  This argument is optional.  Properties and their default values are listed below.\n\n```javascript\n\n        var defaultoptions = {\n            'ignoreSslErrors':true,\n            'localToRemoteUrlAccessEnabled':true,\n            'cookiesFile':'cookies.txt',\n            'diskCache':'yes',\n            'loadImages':'yes',\n            'localToRemoteUrlAccess':'no',\n            'maxDiskCache':'50000',\n            'outputEncoding':'utf8',\n            'proxy':'0',\n            'proxyType':'yes',\n            'scriptEncoding':'yes',\n            'webSecurity':'yes',\n            'port':1061\n        };\n```\n\n### end(callbackFn)\nYou should call end on the returned proxy object to ensure that phantomjs is properly shut down.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create(function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  //do some stuff...\n  //...\n  //call end when done\n  proxy.end(function(){\n    console.log('phantom has exited');\n  });\n});\n```\n\n## phantom Object\nThe phantom object corresponds to the phantom object in the native phantomJs API.\n\n## Page Object\nThe page object corresponds to the webpage object in the native phantomJs API.\n\n### set(propertyName, propertyValue, callbackFn)\nsets setting on page object\n\n```javascript\n  proxy.page.set('userAgent', 'iPad', function (result) {\n      console.log(result.toString());\n  });\n```\n\n### get(propertyName, callbackFn)\ngets a setting on page object\n\n```javascript\n  proxy.page.get('userAgent', function (result) {\n      console.log(result.toString());\n  });\n```\n\n### open(url, callbackFn)\nOpens a webpage with url and callback function arguments.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    console.log('page now open');\n\n    //close proxy\n    phantomProxy.end();\n  });\n\n});\n```\n\n### waitForSelector(selector, callbackFn, timeout)\nPolls page for presence of selector, executes callback when selector is present.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n\n        //close proxy\n        phantomProxy.end();\n    });\n    console.log('page now open');\n  });\n\n});\n```\n\n### render(fileName, callbackFn)\nRenders a image of browser.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n      page.render('myimage.png', function(){\n        console.log('saved my picture!');\n\n        //close proxy\n        phantomProxy.end();\n      });\n    });\n    console.log('page now open');\n  });\n\n});\n```\n\n### renderBase64(type, callbackFn)\nReturns a base64 representation of image.\n\n### evaluate(functionToEvaluate, callbackFn, [arg1, arg2,... argN]\nExecutes functionToEvaluate in phantomJS browser.  Once function executes, callbackFn will be invoked with a result parameter. The Third and sebsequent arguments represent optional parameters which will be passed to the functionToEvaluate function when it is invoked in the browser.\n\n## Events\nThe following events are supported, see [PhantomJs Docs](https://github.com/ariya/phantomjs/wiki/API-Reference) for more information.\n\n<table><thead><th>Event Name</th><th>Notes</th></thead>\n<tbody>\n<tr><td>urlChanged</td><td></td></tr>\n<tr><td>resourceReceived</td><td></td></tr>\n<tr><td>resourceRequested</td><td></td></tr>\n<tr><td>prompt</td><td>Event will fire, but callback will not execute in phantomjs context</td></tr>\n<tr><td>pageCreated</td><td></td></tr>\n<tr><td>navigationRequested</td><td></td></tr>\n<tr><td>loadStarted</td><td></td></tr>\n<tr><td>loadFinished</td><td></td></tr>\n<tr><td>initialized</td><td></td></tr>\n<tr><td>error</td><td></td></tr>\n<tr><td>consoleMessage</td><td></td></tr>\n<tr><td>confirm</td><td>See onConfirmCallback for handling this event</td></tr>\n<tr><td>closing</td><td></td></tr>\n<tr><td>callback</td><td></td></tr>\n<tr><td>alert</td><td></td></tr>\n</tbody>\n</table>\n\n\n#### Subscribing to events\n\n```javascript\nphantomProxy = require('phantom-proxy');\nphantomProxy.create({}, function (proxy) {\n    proxy.page.on('urlChanged', function(){\n      console.log('url changed');\n    });\n});\n```\n\n#### Special events\n\nSome phantomjs functions allow you to return a value to drive phantom interaction. Currently, onConfirm is supported. To register a callback function for intercepting confirm dialogs, use onConfirmCallback:\n\n```javascript\n// return true corresponds to accepting confirm, return false is denying\nproxy.page.set('onConfirmCallback', function(msg) { return true; });\n```\n\nPre-registering a confirm function can be useful if you encounter a page that prompts you when you try to leave. Without registering a function that returns true, phantomjs will hang. Please note you can still listen for the 'confirm' event in conjunction with this special handler.\n\n## Revision History\n* 2012-11-06 - version 0.1.6\n - reworked event communication interface to use socket.io - no longer using filesyste to pass event messages, should help with dropped msgs\n* 2012-11-06 - version 0.1.6\n - reworked event communication interface - no longer using stdoutput to pass event messages\n - reworked process creation and exit logic\n - startup time and event latency are much improved - should run much faster than before\n* 2012-11-03 - version 0.1.3\n  - added callback parameter to end method on proxy.\n  - removed unref call in proxy\n  - added debug option\n* 2012-10-22 - version 0.1.2\n  - breaking - changed the way events are consumed, switched to using nodes emmitter to brodcast events as opposed to invoking instance methods on the object.  To fix issues, use [object].on('eventname') style syntax.\n  - Code clean up\n* 2012-10-17 - version 0.1.16\n   - fixed waitforSelector issue\n* 2012-10-12  - version 0.1.15\n    - fixed a problem w/ waitforSelector fn.\n    - fixed problem where process wasn't shutting down existing server.\n* version 0.1.13\n  - added args property handling for phantom object\n  - added ability to specify port for rpc channel\n  - added timeout on waitforSelector function\n  - added ability to pass cmd line arguments for phantom via options object\n* version 0.1.10\n  - cleaned up and reorganized code\n  - added unit tests\n  - fixed process related issues\n\n","readmeFilename":"README.md","_id":"phantom-proxy@0.1.791","dist":{"shasum":"a5a2c2bf34246aab0e71ac18d1609434fc537359","tarball":"https://registry.npmjs.org/phantom-proxy/-/phantom-proxy-0.1.791.tgz","integrity":"sha512-k9/0Q5GZHuOo2IFS58C1xyESgXUp/AcoYXIRhWcc11UPebQh2yq3BqvBDvEXz/9wHH5u0KewvjMbFpL3pWGbQA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFQnDReBi0wxeSMC/WM1nlwN6nx6i+1ryrOlHpnqm2dmAiAqvT+6bXKUhj33wdEiAgZUpdVX8i0sXmJCI+HFHuXGoA=="}]},"_npmVersion":"1.1.65","_npmUser":{"name":"sheebz","email":"rob.schieber@gmail.com"},"maintainers":[{"name":"sheebz","email":"rob.schieber@gmail.com"}]},"0.1.792":{"author":{"name":"Rob Schieber","email":"rob.schieber@gmail.com","url":"https://twitter.com/sheebz"},"bugs":{"mail":"rob.schieber@gmail.com","url":" https://github.com/sheebz/phantom-proxy/issues"},"dependencies":{"colors":"~0.6.0-1","form-data":"~0.0.3","mime":"~1.2.7","q":"~0.8.8","underscore":"~1.4.0","express":" ~3.0.3","socket.io":"~0.9.11","event-stream":"~3.0.10"},"description":"a lightweight proxy that lets you to drive phantomjs from node.","devDependencies":{"cucumber":">0.0.0","mocha":"~1.5.0","should":"~1.2.0","jshint":"latest"},"directories":{"example":"./example","lib":"./lib","test":"./test"},"engines":{"node":">0.6.0"},"keywords":["phantomjs","phantom","cucumber","cucumberjs","feature","testing"],"licenses":[{"type":"MIT","url":"https://github.com/sheebz/phantom-proxy/blob/master/README.md"}],"main":"index.js","name":"phantom-proxy","private":false,"repository":{"type":"git","url":"https://github.com/sheebz/phantom-proxy"},"version":"0.1.792","readme":"# phantom-proxy\n* Allows you to drive [phantomjs](www.phantomjs.org) from [node](www.nodejs.org)\n* Does not rely on alert side effects for communicating with phantomjs\n* Uses Phantom's embedded mongoose web server for communication - more efficient, simpler, faster.\n* Provides a full api - including a parametrized evaluate function - no more hard coded strings\n* Provides additional useful methods such as waitForSelector\n* Can easily integrate with feature testing frameworks such as [cucumber](https://github.com/cucumber/cucumber-js), jasmine, mocha\n\n## Overview\nPhantomJs is an incredibly useful tool for functional and unit testing.  PhantomJs runs in its own process, making it difficult to drive from node.  Phantom-proxy solves this problem, allowing you to fully drive phantomjs from node.\n\n## Installation\n\n`npm install phantom-proxy`\n\n## Usage\n### Examples\nSee the [API](https://github.com/sheebz/phantom-proxy/blob/master/api.md) documentation for more usage information.\n\n#### wait for a specific selector to appear\n```javascript\nvar phantomProxy = require('phantom-proxy');\n\nphantomProxy.create({}, function (proxy) {\n    var page = proxy.page;\n    page.open('http://www.w3.org', function () {\n        page.waitForSelector('body', function () {\n            console.log('body tag present');\n            proxy.end();\n        });\n    });\n\n});\n```\n\n#### render a screenshot\n```javascript\nphantomProxy.create({\"debug\":true}, function (proxy) {\n    proxy.page.open('http://www.w3.org', function (result) {\n        assert.equal(result, true);\n        proxy.page.waitForSelector('body', function (result) {\n            assert.equal(result, true);\n            proxy.page.render('./scratch/scratch.png', function (result) {\n                assert.equal(result, true);\n                proxy.end(function () {\n                  console.log('done');\n                });\n            });\n        }, 1000);\n    });\n});\n\n```\n\n#### subscribe to events - see api docs for complete list\n```javascript\nphantomProxy.create({\"debug\":true}, function (proxy) {\n    self.proxy.page.on('navigationRequested', function (url) {\n      console.log('at %s', url);\n\n      if (url === 'http://www.w3.org') {\n        console.log('at w3.org');\n      }\n      else {\n        console.log('how did we get here?');\n      }\n\n      proxy.end(function () {\n        console.log('done');\n      });\n    });\n\n    proxy.page.open('http://www.w3.org', function (result) {\n      proxy.page.on('alert', function (msg) {\n          if (msg.trim() === 'hello') {\n              console.log('it said hello');\n          }\n\n        proxy.end(function () {\n          console.log('done');\n        });\n      });\n\n\n\n    });\n});\n\n```\n# API Documentation\n## phantomProxy object\n### create([options], callbackFn)\nuse this method to create an instance of the phantom proxy objects.  The return value will be an object with a page proxy and a phantom proxy.  These properties correspond to the phantom and webpage objects on the native phantom API.\n\nWhen this method is called, a new phantomjs process is spawned.  The new phantomjs process creates a mongoose webserver on localhost:1061.  All subsequent communication with phantom occurs via http requests.\n\n#### Options argument (experimental)\nCreate accepts an options object as the first parameter.  This argument is optional.  Properties and their default values are listed below.\n\n```javascript\n\n        var defaultoptions = {\n            'ignoreSslErrors':true,\n            'localToRemoteUrlAccessEnabled':true,\n            'cookiesFile':'cookies.txt',\n            'diskCache':'yes',\n            'loadImages':'yes',\n            'localToRemoteUrlAccess':'no',\n            'maxDiskCache':'50000',\n            'outputEncoding':'utf8',\n            'proxy':'0',\n            'proxyType':'yes',\n            'scriptEncoding':'yes',\n            'webSecurity':'yes',\n            'port':1061\n        };\n```\n\n### end(callbackFn)\nYou should call end on the returned proxy object to ensure that phantomjs is properly shut down.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create(function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n  //do some stuff...\n  //...\n  //call end when done\n  proxy.end(function(){\n    console.log('phantom has exited');\n  });\n});\n```\n\n## phantom Object\nThe phantom object corresponds to the phantom object in the native phantomJs API.\n\n## Page Object\nThe page object corresponds to the webpage object in the native phantomJs API.\n\n### set(propertyName, propertyValue, callbackFn)\nsets setting on page object\n\n```javascript\n  proxy.page.set('userAgent', 'iPad', function (result) {\n      console.log(result.toString());\n  });\n```\n\n### get(propertyName, callbackFn)\ngets a setting on page object\n\n```javascript\n  proxy.page.get('userAgent', function (result) {\n      console.log(result.toString());\n  });\n```\n\n### open(url, callbackFn)\nOpens a webpage with url and callback function arguments.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    console.log('page now open');\n\n    //close proxy\n    phantomProxy.end();\n  });\n\n});\n```\n\n### waitForSelector(selector, callbackFn, timeout)\nPolls page for presence of selector, executes callback when selector is present.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n\n        //close proxy\n        phantomProxy.end();\n    });\n    console.log('page now open');\n  });\n\n});\n```\n\n### render(fileName, callbackFn)\nRenders a image of browser.\n\n```javascript\nvar phantomProxy = require('phantom-proxy').create({}, function(proxy){\n  var page = proxy.page,\n  phantom = proxy.phantom;\n\n  page.open('http://www.w3.org', function(){\n    page.waitForSelector('body', function(){\n      console.log('body tag present');\n      page.render('myimage.png', function(){\n        console.log('saved my picture!');\n\n        //close proxy\n        phantomProxy.end();\n      });\n    });\n    console.log('page now open');\n  });\n\n});\n```\n\n### renderBase64(type, callbackFn)\nReturns a base64 representation of image.\n\n### evaluate(functionToEvaluate, callbackFn, [arg1, arg2,... argN]\nExecutes functionToEvaluate in phantomJS browser.  Once function executes, callbackFn will be invoked with a result parameter. The Third and sebsequent arguments represent optional parameters which will be passed to the functionToEvaluate function when it is invoked in the browser.\n\n## Events\nThe following events are supported, see [PhantomJs Docs](https://github.com/ariya/phantomjs/wiki/API-Reference) for more information.\n\n<table><thead><th>Event Name</th><th>Notes</th></thead>\n<tbody>\n<tr><td>urlChanged</td><td></td></tr>\n<tr><td>resourceReceived</td><td></td></tr>\n<tr><td>resourceRequested</td><td></td></tr>\n<tr><td>prompt</td><td>Event will fire, but callback will not execute in phantomjs context</td></tr>\n<tr><td>pageCreated</td><td></td></tr>\n<tr><td>navigationRequested</td><td></td></tr>\n<tr><td>loadStarted</td><td></td></tr>\n<tr><td>loadFinished</td><td></td></tr>\n<tr><td>initialized</td><td></td></tr>\n<tr><td>error</td><td></td></tr>\n<tr><td>consoleMessage</td><td></td></tr>\n<tr><td>confirm</td><td>See onConfirmCallback for handling this event</td></tr>\n<tr><td>closing</td><td></td></tr>\n<tr><td>callback</td><td></td></tr>\n<tr><td>alert</td><td></td></tr>\n</tbody>\n</table>\n\n\n#### Subscribing to events\n\n```javascript\nphantomProxy = require('phantom-proxy');\nphantomProxy.create({}, function (proxy) {\n    proxy.page.on('urlChanged', function(){\n      console.log('url changed');\n    });\n});\n```\n\n#### Special events\n\nSome phantomjs functions allow you to return a value to drive phantom interaction. Currently, onConfirm is supported. To register a callback function for intercepting confirm dialogs, use onConfirmCallback:\n\n```javascript\n// return true corresponds to accepting confirm, return false is denying\nproxy.page.set('onConfirmCallback', function(msg) { return true; });\n```\n\nPre-registering a confirm function can be useful if you encounter a page that prompts you when you try to leave. Without registering a function that returns true, phantomjs will hang. Please note you can still listen for the 'confirm' event in conjunction with this special handler.\n\n## Revision History\n* 2012-11-06 - version 0.1.6\n - reworked event communication interface to use socket.io - no longer using filesyste to pass event messages, should help with dropped msgs\n* 2012-11-06 - version 0.1.6\n - reworked event communication interface - no longer using stdoutput to pass event messages\n - reworked process creation and exit logic\n - startup time and event latency are much improved - should run much faster than before\n* 2012-11-03 - version 0.1.3\n  - added callback parameter to end method on proxy.\n  - removed unref call in proxy\n  - added debug option\n* 2012-10-22 - version 0.1.2\n  - breaking - changed the way events are consumed, switched to using nodes emmitter to brodcast events as opposed to invoking instance methods on the object.  To fix issues, use [object].on('eventname') style syntax.\n  - Code clean up\n* 2012-10-17 - version 0.1.16\n   - fixed waitforSelector issue\n* 2012-10-12  - version 0.1.15\n    - fixed a problem w/ waitforSelector fn.\n    - fixed problem where process wasn't shutting down existing server.\n* version 0.1.13\n  - added args property handling for phantom object\n  - added ability to specify port for rpc channel\n  - added timeout on waitforSelector function\n  - added ability to pass cmd line arguments for phantom via options object\n* version 0.1.10\n  - cleaned up and reorganized code\n  - added unit tests\n  - fixed process related issues\n\n","readmeFilename":"README.md","_id":"phantom-proxy@0.1.792","dist":{"shasum":"306931ed6eb1cba8754988ab280fd339b711b56b","tarball":"https://registry.npmjs.org/phantom-proxy/-/phantom-proxy-0.1.792.tgz","integrity":"sha512-P7DFNwA8t5iDW1X7QcJ24heifj2aAjzLBl1/G8tYtiHfj9yHH8Dn0Udsctu/QhQuDC1UxvZpudi8YCbGhx5NiQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHIGBYm84ECBYKJC7i0BJxpevUR4O+S0QhsWvZOUtaBFAiBvx9CWmSId9LVF1DBhCymYHq/uW+XXL1r/SDktEmHeng=="}]},"_npmVersion":"1.1.65","_npmUser":{"name":"sheebz","email":"rob.schieber@gmail.com"},"maintainers":[{"name":"sheebz","email":"rob.schieber@gmail.com"}]}},"readme":"phantom-proxy\n=============\n\nnodejs proxy for phantomjs headless webkit browser","maintainers":[{"name":"sheebz","email":"rob.schieber@gmail.com"}],"time":{"modified":"2022-06-23T20:33:18.638Z","created":"2012-10-02T11:18:54.538Z","0.0.1":"2012-10-02T11:18:56.059Z","0.0.2":"2012-10-02T14:59:03.992Z","0.0.3":"2012-10-02T16:18:47.626Z","0.1.0":"2012-10-03T02:38:53.556Z","0.1.1":"2012-10-03T02:52:01.962Z","0.1.3":"2012-10-03T03:23:09.004Z","0.1.4":"2012-10-03T09:33:08.421Z","0.1.5":"2012-10-03T17:21:24.026Z","0.1.6":"2012-10-04T12:04:34.717Z","0.1.7":"2012-10-04T22:50:00.769Z","0.1.8":"2012-10-06T09:22:18.932Z","0.1.9":"2012-10-06T10:53:25.704Z","0.1.10":"2012-10-07T02:39:39.927Z","0.1.12":"2012-10-07T02:50:49.863Z","0.1.14":"2012-10-08T00:37:30.297Z","0.1.15":"2012-10-14T17:31:29.121Z","0.1.16":"2012-10-17T04:17:05.726Z","0.1.17":"2012-10-17T04:25:52.450Z","0.1.18":"2012-10-17T14:08:09.977Z","0.1.19":"2012-10-17T15:41:10.020Z","0.1.2":"2012-10-21T15:25:55.588Z","0.1.51":"2012-11-06T13:32:37.357Z","0.1.61":"2012-11-08T02:50:31.027Z","0.1.62":"2012-11-08T02:57:20.671Z","0.1.64":"2012-11-08T03:00:18.570Z","0.1.65":"2012-11-08T03:10:31.564Z","0.1.66":"2012-11-08T03:38:05.823Z","0.1.67":"2012-11-08T04:30:22.553Z","0.1.68":"2012-11-08T04:32:04.910Z","0.1.69":"2012-11-08T13:24:22.658Z","0.1.71":"2012-11-13T08:43:14.299Z","0.1.72":"2012-11-15T02:19:02.334Z","0.1.721":"2012-11-15T04:08:10.821Z","0.1.73":"2012-11-15T11:46:18.954Z","0.1.74":"2012-11-30T11:37:43.735Z","0.1.75":"2012-11-30T11:42:28.321Z","0.1.76":"2012-12-24T11:20:03.497Z","0.1.77":"2013-01-01T23:40:11.677Z","0.1.78":"2013-01-02T12:51:27.864Z","0.1.79":"2013-01-13T21:57:11.772Z","0.1.791":"2013-01-13T23:03:21.050Z","0.1.792":"2013-01-14T13:20:27.094Z"},"author":{"name":"Rob Schieber","email":"rob.schieber@gmail.com","url":"https://twitter.com/sheebz"},"repository":{"type":"git","url":"https://github.com/sheebz/phantom-proxy"}}