Browse files

Add support for more commands.

* body - Retrieve the body of the current frame.
* evaluate - Evaluate JavaScript code.
* headers - Retrieve the response headers.
* render - Render the page as an image to a file
* reset - Reset the browser.
* status - Retrieve the HTTP status code.
* url - Retrieve the current URL.
  • Loading branch information...
1 parent dd118e2 commit bfda770013a14a2a7c22e0e678dac1b6ade8edb2 @tristandunn committed Oct 22, 2011
Showing with 28 additions and 0 deletions.
  1. +28 −0 lib/browser.js
View
28 lib/browser.js
@@ -22,14 +22,42 @@ var Browser = function(callback) {
process.on("exit", this.stop.bind(this));
};
+Browser.prototype.body = function(callback) {
+ this.command("Body", callback);
+};
+
+Browser.prototype.evaluate = function(code, callback) {
+ this.command("Evaluate", code, callback);
+};
+
Browser.prototype.execute = function(code, callback) {
this.command("Execute", code, callback);
};
+Browser.prototype.headers = function(callback) {
+ this.command("Headers", callback);
+};
+
+Browser.prototype.render = function(path, width, height, callback) {
+ this.command("Render", path, width, height, callback);
+};
+
+Browser.prototype.reset = function(callback) {
+ this.command("Reset", callback);
+};
+
Browser.prototype.source = function(callback) {
this.command("Source", callback);
};
+Browser.prototype.status = function(callback) {
+ this.command("Status", callback);
+};
+
+Browser.prototype.url = function(callback) {
+ this.command("Url", callback);
+};
+
Browser.prototype.visit = function(path, callback) {
this.command("Visit", path, callback);
};

0 comments on commit bfda770

Please sign in to comment.