Socket
Socket
Sign inDemoInstall

wd

Package Overview
Dependencies
Maintainers
1
Versions
110
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wd - npm Package Compare versions

Comparing version 0.0.17 to 0.0.18

examples/example.firefox.js

4

doc/jsonwiremap-all.md

@@ -176,3 +176,3 @@ <table class="wikitable">

<li>
execute script within try/catch using eval(code): <br>
execute script using eval(code): <br>
safeExecute(code, args, cb) -> cb(err, value returned)

@@ -209,3 +209,3 @@ <ul>

<li>
execute async script within try/catch using eval(code): <br>
execute async script using eval(code): <br>
safeExecuteAsync(code, args, cb) -> cb(err, value returned)

@@ -212,0 +212,0 @@ <ul>

@@ -158,3 +158,3 @@ <table class="wikitable">

<li>
execute script within try/catch using eval(code): <br>
execute script using eval(code): <br>
safeExecute(code, args, cb) -> cb(err, value returned)

@@ -191,3 +191,3 @@ <ul>

<li>
execute async script within try/catch using eval(code): <br>
execute async script using eval(code): <br>
safeExecuteAsync(code, args, cb) -> cb(err, value returned)

@@ -194,0 +194,0 @@ <ul>

@@ -5,7 +5,4 @@ var code = arguments[0], args = arguments[1], done = arguments[2];

};
try {
args.push(done);
return wrap.apply(this, args);
} catch (err) {
throw err;
}
args.push(done);
return wrap.apply(this, args);
var code = arguments[0], args = arguments[1];
var wrap = function() {
return eval(code);
};
try {
return wrap.apply(this, args);
} catch (err) {
throw err;
}
return wrap.apply(this, args);

@@ -8,3 +8,3 @@ // run in the browser

// recursive implementation
waitForConditionImpl = function(conditionExpr, limit, poll, cb) {
var waitForConditionImpl = function(conditionExpr, limit, poll, cb) {

@@ -14,3 +14,3 @@ // timeout check

// condition check
res = eval(conditionExpr);
var res = eval(conditionExpr);
if (res == true ) {

@@ -33,3 +33,3 @@ // condition ok

// calling impl
limit = Date.now() + timeout;
var limit = Date.now() + timeout;
waitForConditionImpl(condExpr, limit, poll, cb);
var http = require('http')
, __slice = Array.prototype.slice;
, __slice = Array.prototype.slice
,JSONWIRE_ERRORS = require('./jsonwire-errors.js')
,element = require('./element').element;

@@ -14,2 +16,9 @@ var strip = function strip(str) {

var getJsonwireError = function(status) {
var jsonwireError = JSONWIRE_ERRORS.filter(function(err) {
return err.status = status;
});
return ((jsonwireError.length>0) ? jsonwireError[0] : null);
};
var newError = function(opts)

@@ -24,2 +33,3 @@ {

var res = "";
var browserError = null;
for (var k in this) {

@@ -36,7 +46,12 @@ var _this = this;

return '[hidden]';
} else if (key === 'message') {
// trying to extract browser error message
var messageMatch = value.match(/([^\n]+)\nCommand duration/);
if((messageMatch!=null) && (messageMatch.length >= 1)) { browserError = messageMatch[1].trim(); }
return value;
} else {
return value;
}
}, " ");
res = res + k + ": " + vAsStr + "\n";
}, " ");
res += k + ": " + vAsStr + "\n";
} else {

@@ -49,3 +64,3 @@ // for other objects making sure output is not too long

}
res = res + k + ": " + vAsStr + "\n";
res += k + ": " + vAsStr + "\n";
}

@@ -55,6 +70,9 @@ } else if (typeof v != 'function')

// printing non object types without modif
res = res + k + ": " + v + "\n";
res += k + ": " + v + "\n";
}
})();
};
if(browserError != null){
res += "browser-error: " + browserError + "\n";
}
return res;

@@ -115,4 +133,7 @@ };

if (obj.status > 0) {
cb(newError(
{message:'Error response status.',status:obj.status,cause:obj}));
var err = newError(
{message:'Error response status.',status:obj.status,cause:obj});
var jsonwireError = getJsonwireError(obj.status);
if(jsonwireError != null){ err['jsonwire-error'] = jsonwireError; }
cb(err);
} else {

@@ -138,2 +159,3 @@ cb(null, obj);

return callbackWithDataBase(function(err, obj) {
_this = this;
if(err != null) {return cb(err);}

@@ -146,3 +168,4 @@ if(isWebDriverException(obj.value)) {return cb(newError(

} else {
cb(null, obj.value.ELEMENT);
var el = new element(obj.value.ELEMENT, _this);
cb(null, el);
}

@@ -155,2 +178,3 @@ });

return callbackWithDataBase(function(err, obj) {
_this = this;
if(err != null) {return cb(err);}

@@ -163,3 +187,4 @@ if(isWebDriverException(obj.value)) {return cb(newError(

for (i = 0; i < obj.value.length; i++) {
elements.push(obj.value[i].ELEMENT);
var el = new element(obj.value[i].ELEMENT, _this);
elements.push(el);
}

@@ -166,0 +191,0 @@ cb(null, elements);

var EventEmitter = require('events').EventEmitter
, __slice = Array.prototype.slice
, protocol = require('./protocol'),
SPECIAL_KEYS = require('./special-keys');
, protocol = require('./protocol')
, SPECIAL_KEYS = require('./special-keys')
, element = require('./element').element;

@@ -24,5 +25,4 @@ // webdriver client main class

, javascriptEnabled: true
, platform: 'ANY'
, platform: 'ANY'
};
// saucelabs default

@@ -80,6 +80,10 @@ if ((this.username != null) && (this.accessKey != null)) {

var rwc = parseRemoteWdConfig(args);
return new webdriver(rwc);
var wd = new webdriver(rwc);
element.prototype.wd = wd;
return wd;
};
exports.SPECIAL_KEYS = SPECIAL_KEYS

@@ -1,4 +0,7 @@

fs = require('fs');
var fs = require('fs');
var builder = require('./builder');
var element = require('./element').element;
console.log(element);
var methodBuilder = builder.methodBuilder

@@ -281,3 +284,3 @@ , callbackWithData = builder.callbackWithData

var elFuncSuffix = function(type){
res = (' by ' + type).replace(/(\s[a-z])/g,
var res = (' by ' + type).replace(/(\s[a-z])/g,
function($1){return $1.toUpperCase().replace(' ','');});

@@ -365,3 +368,3 @@ return res.replace('Xpath', 'XPath');

, data: function(element, xoffset, yoffset) {
return { element: element, xoffset: xoffset, yoffset: yoffset }; }
return { element: element.toString(), xoffset: xoffset, yoffset: yoffset }; }
});

@@ -434,3 +437,3 @@

// element must be specified
_rawText = methodBuilder({
var _rawText = methodBuilder({
method: 'GET'

@@ -478,3 +481,5 @@ , relPath: function(element) { return '/element/' + element + '/text'; }

, cb: function(cb) {
return callbackWithData(function(e, o) { cb(null, o['ELEMENT'])});
return callbackWithData(function(e, o) {
var el = new element(o['ELEMENT'], this);
cb(null, el)});
}

@@ -535,3 +540,3 @@ });

// condition check
protocol.eval.apply( _this , [conditionExpr, function(err, res) {
protocol.safeEval.apply( _this , [conditionExpr, function(err, res) {
if(err != null) {return cb(err);}

@@ -550,3 +555,3 @@ if (res == true) {

// try one last time
protocol.eval.apply( _this, [conditionExpr, function(err, res) {
protocol.safeEval.apply( _this, [conditionExpr, function(err, res) {
if(err != null) {return cb(err);}

@@ -601,3 +606,3 @@ if (res == true) {

// calling script
protocol.executeAsync.apply( _this, [waitForConditionInBrowserJsScript,
protocol.safeExecuteAsync.apply( _this, [waitForConditionInBrowserJsScript,
[conditionExpr,timeout,poll], function(err,res) {

@@ -604,0 +609,0 @@ if(err != null) {return cb(err);}

@@ -5,3 +5,3 @@ {

, "tags" : ["web", "automation", "browser", "javascript"]
, "version" : "0.0.17"
, "version" : "0.0.18"
, "author" : "Adam Christian <adam.christian@gmail.com>"

@@ -23,4 +23,5 @@ , "repository" :

,"express": "latest"
,"async": "latest"
,"async": "latest"
,"gleak": "latest"
}
}

@@ -55,3 +55,3 @@ # WD.js -- A light weight WebDriver/Se2 client for node.js

, tags: ["examples"]
, name = "This is an example test"
, name: "This is an example test"
}

@@ -235,3 +235,3 @@

<li>
execute script within try/catch using eval(code): <br>
execute script using eval(code): <br>
safeExecute(code, args, cb) -> cb(err, value returned)

@@ -268,3 +268,3 @@ <ul>

<li>
execute async script within try/catch using eval(code): <br>
execute async script using eval(code): <br>
safeExecuteAsync(code, args, cb) -> cb(err, value returned)

@@ -271,0 +271,0 @@ <ul>

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.3.2
// Generated by CoffeeScript 1.3.3
(function() {

@@ -3,0 +3,0 @@ var assert, runTestWith, should, wd;

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.3.2
// Generated by CoffeeScript 1.3.3
(function() {

@@ -3,0 +3,0 @@ var chromeDesired, configHelper, explorerDesired, firefoxDesired, nameBase, remoteWdConfig, runTestWith;

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.3.2
// Generated by CoffeeScript 1.3.3
(function() {

@@ -3,0 +3,0 @@ var configHelper, remoteWdConfig, should, wd;

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.3.2
// Generated by CoffeeScript 1.3.3
(function() {

@@ -3,0 +3,0 @@ var config, should;

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.3.2
// Generated by CoffeeScript 1.3.3
(function() {

@@ -3,0 +3,0 @@

@@ -1,5 +0,7 @@

// Generated by CoffeeScript 1.3.2
// Generated by CoffeeScript 1.3.3
(function() {
var runTestWith;
var leakDetector, runTestWith;
leakDetector = (require('../common/leak-detector'))();
runTestWith = require('../common/basic-test-base').runTestWith;

@@ -14,3 +16,4 @@

browserName: 'firefox'
})
}),
'checking leaks': leakDetector.lookForLeaks
}

@@ -17,0 +20,0 @@ };

@@ -1,9 +0,11 @@

// Generated by CoffeeScript 1.3.2
// Generated by CoffeeScript 1.3.3
(function() {
var should, wd;
var leakDetector, should, wd;
should = require('should');
leakDetector = (require('../common/leak-detector'))();
wd = require('../../lib/main');
should = require('should');
exports.wd = {

@@ -101,3 +103,4 @@ 'browser init test': {

});
}
},
'checking leaks': leakDetector.lookForLeaks
}

@@ -104,0 +107,0 @@ };

@@ -1,7 +0,5 @@

// Generated by CoffeeScript 1.3.2
// Generated by CoffeeScript 1.3.3
(function() {
var CoffeeScript, app, async, elementByCss, evalShouldEqual, executeCoffee, express, runTestWith, safeEvalShouldEqual, should, textShouldEqual, valueShouldEqual, wd;
var CoffeeScript, app, async, elementByCss, evalShouldEqual, executeCoffee, express, leakDetector, runTestWith, safeEvalShouldEqual, should, textShouldEqual, valueShouldEqual, wd;
wd = require('../../lib/main');
should = require('should');

@@ -15,2 +13,6 @@

leakDetector = (require('../common/leak-detector'))();
wd = require('../../lib/main');
evalShouldEqual = function(browser, formula, expected) {

@@ -1097,4 +1099,9 @@ return function(done) {

return browser.active(function(err, res) {
var k, _i, _len;
should.not.exist(err);
res.should.equal(env.i1);
for (_i = 0, _len = res.length; _i < _len; _i++) {
k = res[_i];
res.should.equal(env.i1[k]);
env.i1.should.have.property(k);
}
return done(null);

@@ -1109,4 +1116,9 @@ });

return browser.active(function(err, res) {
var k, _i, _len;
should.not.exist(err);
res.should.equal(env.i2);
for (_i = 0, _len = res.length; _i < _len; _i++) {
k = res[_i];
res.should.equal(env.i2[k]);
env.i2.should.have.property(k);
}
return done(null);

@@ -1256,2 +1268,7 @@ });

});
}, function(done) {
return browser.waitForCondition('$wrong expr!!!', function(err, res) {
should.exist(err);
return done(null);
});
}

@@ -1297,2 +1314,7 @@ ], function(err) {

}, function(done) {
return browser.waitForConditionInBrowser("totally #} wrong == expr", function(err, res) {
should.exist(err);
return done(null);
});
}, function(done) {
return browser.setAsyncScriptTimeout(0, function(err, res) {

@@ -1312,3 +1334,5 @@ should.not.exist(err);

(err instanceof Error).should.be["true"];
should.exist(err['jsonwire-error']);
err.inspect().should.include('"screen": "[hidden]"');
err.inspect().should.include('browser-error:');
return test.done();

@@ -1351,3 +1375,4 @@ });

return test.done();
}
},
'checking leaks': leakDetector.lookForLeaks
}

@@ -1354,0 +1379,0 @@ };

@@ -1,9 +0,11 @@

// Generated by CoffeeScript 1.3.2
// Generated by CoffeeScript 1.3.3
(function() {
var should, wd;
var leakDetector, should, wd;
should = require('should');
leakDetector = (require('../common/leak-detector'))();
wd = require('../../lib/main');
should = require('should');
exports.wd = {

@@ -133,3 +135,4 @@ 'remote init test': {

}
}
},
'checking leaks': leakDetector.lookForLeaks
}

@@ -136,0 +139,0 @@ };

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc