Skip to content

Instantly share code, notes, and snippets.

@SPLESH
Created December 27, 2011 16:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SPLESH/d6e5cd4613d7ccf72d19 to your computer and use it in GitHub Desktop.
Save SPLESH/d6e5cd4613d7ccf72d19 to your computer and use it in GitHub Desktop.
Fix for issue with execute js
From 099821790dc74553118731821b47d6952ca85edc Mon Sep 17 00:00:00 2001
From: Sergey Ermolaev <splesh2009@gmai.com>
Date: Tue, 27 Dec 2011 17:59:06 +0200
Subject: [PATCH] Fix of execute javaScript command
---
node_modules/webdriverjs/lib/protocol/execute.js | 28 ++++++++++++---------
1 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/node_modules/webdriverjs/lib/protocol/execute.js b/node_modules/webdriverjs/lib/protocol/execute.js
index a05ed71..9cf9f24 100644
--- a/node_modules/webdriverjs/lib/protocol/execute.js
+++ b/node_modules/webdriverjs/lib/protocol/execute.js
@@ -1,16 +1,20 @@
var http = require("http");
-exports.command = function(script, callback)
-{
-
- var commandOptions = {
- path: "/session/:sessionId/execute",
- method: "POST"
- }
-
- var request = this.createRequest(commandOptions, this.proxyResponse(callback));
- var data = JSON.stringify( {"script": script, args: []} );
- request.write(data);
- request.end();
+exports.command = function(script, callback) {
+
+ var commandOptions = {
+ path: "/session/:sessionId/execute",
+ method: "POST"
+ }
+
+ var self = this;
+
+ var data = {"script": script, args: []};
+
+ this.executeProtocolCommand(
+ commandOptions,
+ self.proxyResponse(callback),
+ data
+ );
};
\ No newline at end of file
--
1.7.5.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment