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.24 to 0.0.25

doc/jsonwire-full-mapping.md

82

lib/element.js

@@ -21,6 +21,19 @@ //Element object

element.prototype.sendKeys = function (keys, cb) {
/**
* element.type(keys, cb) -> cb(err)
*
* @jsonWire POST /session/:sessionId/element/:id/value
*/
element.prototype.type = function (keys, cb) {
this.browser.type(this, keys, cb);
};
element.prototype.sendKeys = element.prototype.type
/**
* element.click(cb) -> cb(err)
*
* @jsonWire POST /session/:sessionId/element/:id/click
*/
element.prototype.click = function (cb) {

@@ -30,2 +43,8 @@ this.browser.clickElement(this, cb);

/**
* element.text(cb) -> (err, text)
*
* @jsonWire GET /session/:sessionId/element/:id/text
* @docOrder 2
*/
element.prototype.text = function (cb) {

@@ -35,2 +54,8 @@ this.browser.text(this, cb);

/**
* element.textPresent(searchText, cb) -> (err, boolean)
*
* @jsonWire GET /session/:sessionId/element/:id/text
* @docOrder 4
*/
element.prototype.textPresent = function(searchText, cb) {

@@ -40,2 +65,8 @@ this.browser.textPresent(searchText, this, cb);

/**
* element.getAttribute(attrName, cb) -> cb(err, value)
*
* @jsonWire GET /session/:sessionId/element/:id/attribute/:name
* @docOrder 2
*/
element.prototype.getAttribute = function(name, cb) {

@@ -45,2 +76,35 @@ this.browser.getAttribute(this, name, cb);

/**
* element.getTagName(cb) -> cb(err, name)
*
* @jsonWire GET /session/:sessionId/element/:id/name
*/
element.prototype.getTagName = function(cb) {
this.browser.getTagName(this, cb);
};
/**
* element.isDisplayed(cb) -> cb(err, displayed)
*
* @jsonWire GET /session/:sessionId/element/:id/displayed
*/
element.prototype.isDisplayed = function(cb) {
this.browser.isDisplayed(this, cb);
};
element.prototype.displayed = element.prototype.isDisplayed
/**
* isVisible(cb) -> cb(err, boolean)
*/
element.prototype.isVisible = function(cb) {
this.browser.isVisible(this, cb);
};
/**
* element.getValue(cb) -> cb(err, value)
*
* @jsonWire GET /session/:sessionId/element/:id/attribute/:name
* @docOrder 4
*/
element.prototype.getValue = function(cb) {

@@ -50,6 +114,18 @@ this.browser.getValue(this, cb);

element.prototype.getComputedCSS = function(styleName, cb) {
this.browser.getComputedCSS(this, styleName, cb);
/**
* element.getComputedCss(cssProperty , cb) -> cb(err, value)
*
* @jsonWire GET /session/:sessionId/element/:id/css/:propertyName
*/
element.prototype.getComputedCss = function(styleName, cb) {
this.browser.getComputedCss(this, styleName, cb);
};
element.prototype.getComputedCSS = element.prototype.getComputedCss
/**
* element.clear(cb) -> cb(err)
*
* @jsonWire POST /session/:sessionId/element/:id/clear
*/
element.prototype.clear = function(cb) {

@@ -56,0 +132,0 @@ this.browser.clear(this, cb);

@@ -11,3 +11,3 @@ var EventEmitter = require('events').EventEmitter;

// webdriver client main class
// remoteWdConfig is an option object containing the following fields:
// WdConfig is an option object containing the following fields:
// host,port, username, accessKey

@@ -125,10 +125,23 @@ var webdriver = module.exports = function(remoteWdConfig) {

res.on('end', function() {
if(data == '') {
// expected behaviour
if((data == '') || (data == 'OK')) {
// expected behaviour when not returning JsonWire response
return cb(null)
} else {
// something wrong
if(cb!=null){
return cb(_this._newError(
{message:'Unexpected data in simpleCallback.', data:data}) );
// looking for JsonWire response
var jsonWireRes = null;
try{jsonWireRes = JSON.parse(data);}catch(err){}
if ((jsonWireRes !== null) && (jsonWireRes.sessionId != null) && (jsonWireRes.status != null)) {
// valid JsonWire response
if(jsonWireRes.status === 0) {
return cb(null)
} else {
return cb(_this._newError(
{message:'Error response status.',status:jsonWireRes.status,cause:jsonWireRes} ) );
}
} else {
// something wrong
if(cb!=null){
return cb(_this._newError(
{message:'Unexpected data in simpleCallback.', data:data}) );
}
}

@@ -240,3 +253,9 @@ }

// session initialization
/**
* init(desired, cb) -> cb(err, sessionID)
* Initialize the browser.
*
* @jsonWire POST /session
*/
webdriver.prototype.init = function(desired, cb) {

@@ -363,2 +382,7 @@ var _this = this;

/**
* status(cb) -> cb(err, status)
*
* @jsonWire GET /status
*/
webdriver.prototype.status = function(cb) {

@@ -372,2 +396,7 @@ this._jsonWireCall({

/**
* sessions(cb) -> cb(err, sessions)
*
* @jsonWire GET /sessions
*/
webdriver.prototype.sessions = function(cb) {

@@ -424,4 +453,8 @@ this._jsonWireCall({

// alternate strategy to get session capabilities
// extract session capabilities from session list
/**
* Alternate strategy to get session capabilities from server session list:
* altSessionCapabilities(cb) -> cb(err, capabilities)
*
* @jsonWire GET /sessions
*/
webdriver.prototype.altSessionCapabilities = function(cb) {

@@ -443,2 +476,7 @@ var _this = this;

/**
* sessionCapabilities(cb) -> cb(err, capabilities)
*
* @jsonWire GET /session/:sessionId
*/
webdriver.prototype.sessionCapabilities = function(cb) {

@@ -452,2 +490,23 @@ this._jsonWireCall({

/**
* Opens a new window (using Javascript window.open):
* newWindow(url, name, cb) -> cb(err)
* newWindow(url, cb) -> cb(err)
* name: optional window name
* Window can later be accessed by name with the window method,
* or by getting the last handle returned by the windowHandles method.
*/
webdriver.prototype.newWindow = function(url, name, cb) {
if ((cb == undefined) && (typeof(name) == 'function')) {
cb = name;
name = undefined;
};
this.execute("var url=arguments[0], name=arguments[1]; window.open(url, name);", [url,name] , cb);
}
/**
* close(cb) -> cb(err)
*
* @jsonWire DELETE /session/:sessionId/window
*/
webdriver.prototype.close = function(cb) {

@@ -461,2 +520,7 @@ this._jsonWireCall({

/**
* window(name, cb) -> cb(err)
*
* @jsonWire POST /session/:sessionId/window
*/
webdriver.prototype.window = function(windowRef, cb) {

@@ -471,3 +535,14 @@ this._jsonWireCall({

webdriver.prototype.frame = function(frameRef, cb) {
/**
* frame(frameRef, cb) -> cb(err)
*
* @jsonWire POST /session/:sessionId/frame
*/
webdriver.prototype.frame = function(frameRef, cb) {
// avoid using this, webdriver seems very buggy
// doesn't work at all with chromedriver
if(typeof(frameRef)=='function'){
cb = frameRef;
frameRef = undefined;
}
this._jsonWireCall({

@@ -481,2 +556,14 @@ method: 'POST'

/**
* windowName(cb) -> cb(err, name)
*/
webdriver.prototype.windowName = function(cb) {
this.safeEval("window.name", cb);
};
/**
* windowHandle(cb) -> cb(err, handle)
*
* @jsonWire GET /session/:sessionId/window_handle
*/
webdriver.prototype.windowHandle = function(cb) {

@@ -490,6 +577,7 @@ this._jsonWireCall({

webdriver.prototype.windowName = function(cb) {
this.safeEval("window.name", cb);
};
/**
* windowHandles(cb) -> cb(err, arrayOfHandles)
*
* @jsonWire GET /session/:sessionId/window_handles
*/
webdriver.prototype.windowHandles = function(cb) {

@@ -503,2 +591,8 @@ this._jsonWireCall({

/**
* quit(cb) -> cb(err)
* Destroy the browser.
*
* @jsonWire DELETE /session/:sessionId
*/
webdriver.prototype.quit = function(cb) {

@@ -513,2 +607,8 @@ this._jsonWireCall({

/**
* Evaluate expression (using execute):
* eval(code, cb) -> cb(err, value)
*
* @jsonWire POST /session/:sessionId/execute
*/
webdriver.prototype.eval = function(code, cb) {

@@ -522,2 +622,8 @@ code = "return " + code + ";"

/**
* Evaluate expression (using safeExecute):
* safeEval(code, cb) -> cb(err, value)
*
* @jsonWire POST /session/:sessionId/execute
*/
webdriver.prototype.safeEval = function(code, cb) {

@@ -530,2 +636,10 @@ this.safeExecute.apply( this, [code, function(err, res) {

/**
* execute(code, args, cb) -> cb(err, value returned)
* execute(code, cb) -> cb(err, value returned)
* args: script argument array (optional)
*
* @jsonWire POST /session/:sessionId/execute
* @docOrder 1
*/
webdriver.prototype.execute = function(code,args,cb) {

@@ -554,2 +668,11 @@ // parsing arguments (code,args,cb) with optional args

/**
* Execute script using eval(code):
* safeExecute(code, args, cb) -> cb(err, value returned)
* safeExecute(code, cb) -> cb(err, value returned)
* args: script argument array (optional)
*
* @jsonWire POST /session/:sessionId/execute
* @docOrder 2
*/
webdriver.prototype.safeExecute = function(code,args,cb) {

@@ -575,2 +698,9 @@ // parsing arguments (code,args,cb) with optional args

/**
* executeAsync(code, args, cb) -> cb(err, value returned)
* executeAsync(code, cb) -> cb(err, value returned)
* args: script argument array (optional)
*
* @jsonWire POST /session/:sessionId/execute_async
*/
webdriver.prototype.executeAsync = function(code,args,cb) {

@@ -599,2 +729,10 @@ // parsing arguments (code,args,cb) with optional args

/**
* Execute async script using eval(code):
* safeExecuteAsync(code, args, cb) -> cb(err, value returned)
* safeExecuteAsync(code, cb) -> cb(err, value returned)
* args: script argument array (optional)
*
* @jsonWire POST /session/:sessionId/execute_async
*/
webdriver.prototype.safeExecuteAsync = function(code,args,cb) {

@@ -620,2 +758,8 @@ // parsing arguments (code,args,cb) with optional args

/**
* get(url,cb) -> cb(err)
* Get a new url.
*
* @jsonWire POST /session/:sessionId/url
*/
webdriver.prototype.get = function(url, cb) {

@@ -630,2 +774,7 @@ this._jsonWireCall({

/**
* refresh(cb) -> cb(err)
*
* @jsonWire POST /session/:sessionId/refresh
*/
webdriver.prototype.refresh = function(cb) {

@@ -639,2 +788,7 @@ this._jsonWireCall({

/**
* forward(cb) -> cb(err)
*
* @jsonWire POST /session/:sessionId/forward
*/
webdriver.prototype.forward = function(cb) {

@@ -648,2 +802,7 @@ this._jsonWireCall({

/**
* back(cb) -> cb(err)
*
* @jsonWire POST /session/:sessionId/back
*/
webdriver.prototype.back = function(cb) {

@@ -657,2 +816,8 @@ this._jsonWireCall({

/**
* setImplicitWaitTimeout(ms, cb) -> cb(err)
*
* @jsonWire POST /session/:sessionId/timeouts/implicit_wait
*/
webdriver.prototype.setImplicitWaitTimeout = function(ms, cb) {

@@ -670,2 +835,7 @@ this._jsonWireCall({

/**
* setAsyncScriptTimeout(ms, cb) -> cb(err)
*
* @jsonWire POST /session/:sessionId/timeouts/async_script
*/
webdriver.prototype.setAsyncScriptTimeout = function(ms, cb) {

@@ -680,2 +850,8 @@ this._jsonWireCall({

/**
* setPageLoadTimeout(ms, cb) -> cb(err)
* (use setImplicitWaitTimeout and setAsyncScriptTimeout to set the other timeouts)
*
* @jsonWire POST /session/:sessionId/timeouts
*/
webdriver.prototype.setPageLoadTimeout = function(ms, cb) {

@@ -690,2 +866,7 @@ this._jsonWireCall({

/**
* element(using, value, cb) -> cb(err, element)
*
* @jsonWire POST /session/:sessionId/element
*/
webdriver.prototype.element = function(using, value, cb) {

@@ -700,3 +881,9 @@ this._jsonWireCall({

// avoid not found exception and return null instead
/**
* Retrieve an element avoiding not found exception and returning null instead:
* elementOrNull(using, value, cb) -> cb(err, element)
*
* @jsonWire POST /session/:sessionId/elements
* @docOrder 3
*/
webdriver.prototype.elementOrNull = function(using, value, cb) {

@@ -713,3 +900,9 @@ this.elements.apply(this, [using, value,

// avoid not found exception and return undefined instead
/**
* Retrieve an element avoiding not found exception and returning undefined instead:
* elementIfExists(using, value, cb) -> cb(err, element)
*
* @jsonWire POST /session/:sessionId/elements
* @docOrder 5
*/
webdriver.prototype.elementIfExists = function(using, value, cb) {

@@ -726,2 +919,8 @@ this.elements.apply(this, [using, value,

/**
* elements(using, value, cb) -> cb(err, elements)
*
* @jsonWire POST /session/:sessionId/elements
* @docOrder 1
*/
webdriver.prototype.elements = function(using, value, cb) {

@@ -736,2 +935,9 @@ this._jsonWireCall({

/**
* Check if element exists:
* hasElement(using, value, cb) -> cb(err, boolean)
*
* @jsonWire POST /session/:sessionId/elements
* @docOrder 7
*/
webdriver.prototype.hasElement = function(using, value, cb){

@@ -746,2 +952,62 @@ this.elements.apply( this, [using, value, function(err, elements){

/**
* waitForElement(using, value, timeout, cb) -> cb(err)
*/
webdriver.prototype.waitForElement = function(using, value, timeout, cb){
var _this = this;
var endTime = Date.now() + timeout;
var poll = function(){
_this.hasElement(using, value, function(err, isHere){
if(err){
return cb(err);
}
if(isHere){
cb(null);
} else {
if(Date.now() > endTime){
cb(new Error("Element didn't appear"));
} else {
setTimeout(poll, 200);
}
}
});
}
poll();
}
/**
* waitForVisible(using, value, timeout, cb) -> cb(err)
*/
webdriver.prototype.waitForVisible = function(using, value, timeout, cb) {
var _this = this;
var endTime = Date.now() + timeout;
var poll = function(){
_this.isVisible(using, value, function(err, visible) {
if (err) {
return cb(err);
}
if (visible) {
cb(null);
} else {
if (Date.now() > endTime) {
cb(new Error("Element didn't become visible"));
} else {
setTimeout(poll, 200);
}
}
});
}
poll();
}
/**
* takeScreenshot(cb) -> cb(err, screenshot)
*
* @jsonWire GET /session/:sessionId/screenshot
*/
webdriver.prototype.takeScreenshot = function(cb) {

@@ -778,3 +1044,15 @@ this._jsonWireCall({

var type = elementFuncTypes[i];
/**
* elementByClassName(value, cb) -> cb(err, element)
* elementByCssSelector(value, cb) -> cb(err, element)
* elementById(value, cb) -> cb(err, element)
* elementByName(value, cb) -> cb(err, element)
* elementByLinkText(value, cb) -> cb(err, element)
* elementByPartialLinkText(value, cb) -> cb(err, element)
* elementByTagName(value, cb) -> cb(err, element)
* elementByXPath(value, cb) -> cb(err, element)
* elementByCss(value, cb) -> cb(err, element)
*
* @jsonWire POST /session/:sessionId/element
*/
webdriver.prototype['element' + elFuncSuffix(type)] = function(value, cb) {

@@ -784,3 +1062,16 @@ webdriver.prototype.element.apply(this, [elFuncFullType(type), value, cb]);

// avoid not found exception and return null instead
/**
* elementByClassNameOrNull(value, cb) -> cb(err, element)
* elementByCssSelectorOrNull(value, cb) -> cb(err, element)
* elementByIdOrNull(value, cb) -> cb(err, element)
* elementByNameOrNull(value, cb) -> cb(err, element)
* elementByLinkTextOrNull(value, cb) -> cb(err, element)
* elementByPartialLinkTextOrNull(value, cb) -> cb(err, element)
* elementByTagNameOrNull(value, cb) -> cb(err, element)
* elementByXPathOrNull(value, cb) -> cb(err, element)
* elementByCssOrNull(value, cb) -> cb(err, element)
*
* @jsonWire POST /session/:sessionId/elements
* @docOrder 4
*/
webdriver.prototype['element' + elFuncSuffix(type)+ 'OrNull'] = function(value, cb) {

@@ -797,3 +1088,16 @@ webdriver.prototype.elements.apply(this, [elFuncFullType(type), value,

// avoid not found exception and return undefined instead
/**
* elementByClassNameIfExists(value, cb) -> cb(err, element)
* elementByCssSelectorIfExists(value, cb) -> cb(err, element)
* elementByIdIfExists(value, cb) -> cb(err, element)
* elementByNameIfExists(value, cb) -> cb(err, element)
* elementByLinkTextIfExists(value, cb) -> cb(err, element)
* elementByPartialLinkTextIfExists(value, cb) -> cb(err, element)
* elementByTagNameIfExists(value, cb) -> cb(err, element)
* elementByXPathIfExists(value, cb) -> cb(err, element)
* elementByCssIfExists(value, cb) -> cb(err, element)
*
* @jsonWire POST /session/:sessionId/elements
* @docOrder 6
*/
webdriver.prototype['element' + elFuncSuffix(type)+ 'IfExists'] = function(value, cb) {

@@ -810,2 +1114,16 @@ webdriver.prototype.elements.apply(this, [elFuncFullType(type), value,

/**
* hasElementByClassName(value, cb) -> cb(err, boolean)
* hasElementByCssSelector(value, cb) -> cb(err, boolean)
* hasElementById(value, cb) -> cb(err, boolean)
* hasElementByName(value, cb) -> cb(err, boolean)
* hasElementByLinkText(value, cb) -> cb(err, boolean)
* hasElementByPartialLinkText(value, cb) -> cb(err, boolean)
* hasElementByTagName(value, cb) -> cb(err, boolean)
* hasElementByXPath(value, cb) -> cb(err, boolean)
* hasElementByCss(value, cb) -> cb(err, boolean)
*
* @jsonWire POST /session/:sessionId/elements
* @docOrder 8
*/
webdriver.prototype['hasElement' + elFuncSuffix(type)] = function(value, cb) {

@@ -815,2 +1133,46 @@ webdriver.prototype.hasElement.apply(this, [elFuncFullType(type), value, cb]);

/**
* waitForElementByClassName(value, timeout, cb) -> cb(err)
* waitForElementByCssSelector(value, timeout, cb) -> cb(err)
* waitForElementById(value, timeout, cb) -> cb(err)
* waitForElementByName(value, timeout, cb) -> cb(err)
* waitForElementByLinkText(value, timeout, cb) -> cb(err)
* waitForElementByPartialLinkText(value, timeout, cb) -> cb(err)
* waitForElementByTagName(value, timeout, cb) -> cb(err)
* waitForElementByXPath(value, timeout, cb) -> cb(err)
* waitForElementByCss(value, timeout, cb) -> cb(err)
*/
webdriver.prototype['waitForElement' + elFuncSuffix(type)] = function(value, timeout, cb) {
webdriver.prototype.waitForElement.apply(this, [elFuncFullType(type), value, timeout, cb]);
};
/**
* waitForVisibleByClassName(value, timeout, cb) -> cb(err)
* waitForVisibleByCssSelector(value, timeout, cb) -> cb(err)
* waitForVisibleById(value, timeout, cb) -> cb(err)
* waitForVisibleByName(value, timeout, cb) -> cb(err)
* waitForVisibleByLinkText(value, timeout, cb) -> cb(err)
* waitForVisibleByPartialLinkText(value, timeout, cb) -> cb(err)
* waitForVisibleByTagName(value, timeout, cb) -> cb(err)
* waitForVisibleByXPath(value, timeout, cb) -> cb(err)
* waitForVisibleByCss(value, timeout, cb) -> cb(err)
*/
webdriver.prototype['waitForVisible' + elFuncSuffix(type)] = function(value, timeout, cb) {
webdriver.prototype.waitForVisible.apply(this, [elFuncFullType(type), value, timeout, cb]);
};
/**
* elementsByClassName(value, cb) -> cb(err, elements)
* elementsByCssSelector(value, cb) -> cb(err, elements)
* elementsById(value, cb) -> cb(err, elements)
* elementsByName(value, cb) -> cb(err, elements)
* elementsByLinkText(value, cb) -> cb(err, elements)
* elementsByPartialLinkText(value, cb) -> cb(err, elements)
* elementsByTagName(value, cb) -> cb(err, elements)
* elementsByXPath(value, cb) -> cb(err, elements)
* elementsByCss(value, cb) -> cb(err, elements)
*
* @jsonWire POST /session/:sessionId/elements
* @docOrder 2
*/
webdriver.prototype['elements' + elFuncSuffix(type)] = function(value, cb) {

@@ -824,2 +1186,21 @@ webdriver.prototype.elements.apply(this, [elFuncFullType(type), value, cb]);

/**
* getTagName(element, cb) -> cb(err, name)
*
* @jsonWire GET /session/:sessionId/element/:id/name
*/
webdriver.prototype.getTagName = function(element, cb) {
this._jsonWireCall({
method: 'GET'
, relPath: '/element/' + element + '/name'
, cb: this._callbackWithData(cb)
});
}
/**
* getAttribute(element, attrName, cb) -> cb(err, value)
*
* @jsonWire GET /session/:sessionId/element/:id/attribute/:name
* @docOrder 1
*/
webdriver.prototype.getAttribute = function(element, attrName, cb) {

@@ -833,3 +1214,8 @@ this._jsonWireCall({

webdriver.prototype.displayed = function(element, cb) {
/**
* isDisplayed(element, cb) -> cb(err, displayed)
*
* @jsonWire GET /session/:sessionId/element/:id/displayed
*/
webdriver.prototype.isDisplayed = function(element, cb) {
this._jsonWireCall({

@@ -842,2 +1228,11 @@ method: 'GET'

webdriver.prototype.displayed = webdriver.prototype.isDisplayed
/**
* Get element value (in value attribute):
* getValue(element, cb) -> cb(err, value)
*
* @jsonWire GET /session/:sessionId/element/:id/attribute/:name
* @docOrder 3
*/
webdriver.prototype.getValue = function(element, cb) {

@@ -847,2 +1242,7 @@ this.getAttribute.apply(this, [element, 'value', cb]);

/**
* clickElement(element, cb) -> cb(err)
*
* @jsonWire POST /session/:sessionId/element/:id/click
*/
webdriver.prototype.clickElement = function(element, cb) {

@@ -856,6 +1256,11 @@ this._jsonWireCall({

webdriver.prototype.getComputedCSS = function(element, styleName, cb) {
/**
* getComputedCss(element, cssProperty , cb) -> cb(err, value)
*
* @jsonWire GET /session/:sessionId/element/:id/css/:propertyName
*/
webdriver.prototype.getComputedCss = function(element, cssProperty, cb) {
this._jsonWireCall({
method: 'GET'
, relPath: '/element/' + element + '/css/' + styleName
, relPath: '/element/' + element + '/css/' + cssProperty
, cb: this._callbackWithData(cb)

@@ -865,2 +1270,10 @@ });

webdriver.prototype.getComputedCSS = webdriver.prototype.getComputedCss
/**
* moveTo(element, xoffset, yoffset, cb) -> cb(err)
* Move to element, xoffset and y offset are optional.
*
* @jsonWire POST /session/:sessionId/moveto
*/
webdriver.prototype.moveTo = function(element, xoffset, yoffset, cb) {

@@ -882,2 +1295,7 @@ // parsing arguments, xoffset and y offset are optional

/**
* buttonDown(cb) -> cb(err)
*
* @jsonWire POST /session/:sessionId/buttondown
*/
webdriver.prototype.buttonDown = function(cb) {

@@ -891,2 +1309,7 @@ this._jsonWireCall({

/**
* buttonUp(cb) -> cb(err)
*
* @jsonWire POST /session/:sessionId/buttonup
*/
webdriver.prototype.buttonUp = function(cb) {

@@ -900,3 +1323,9 @@ this._jsonWireCall({

//{LEFT = 0, MIDDLE = 1 , RIGHT = 2}
/**
* click(button, cb) -> cb(err)
* Click on current element.
* Buttons: {left: 0, middle: 1 , right: 2}
*
* @jsonWire POST /session/:sessionId/click
*/
webdriver.prototype.click = function(button, cb) {

@@ -916,2 +1345,7 @@ // parsing args, button optional

/**
* doubleclick(cb) -> cb(err)
*
* @jsonWire POST /session/:sessionId/doubleclick
*/
webdriver.prototype.doubleclick = function(cb) {

@@ -925,3 +1359,9 @@ this._jsonWireCall({

//All keys are up at end of command
/**
* type(element, keys, cb) -> cb(err)
* Type keys (all keys are up at the end of command).
* special key map: wd.SPECIAL_KEYS (see lib/special-keys.js)
*
* @jsonWire POST /session/:sessionId/element/:id/value
*/
webdriver.prototype.type = function(element, keys, cb) {

@@ -937,2 +1377,9 @@ if (!(keys instanceof Array)) {keys = [keys];}

/**
* keys(keys, cb) -> cb(err)
* Press keys (keys may still be down at the end of command).
* special key map: wd.SPECIAL_KEYS (see lib/special-keys.js)
*
* @jsonWire POST /session/:sessionId/keys
*/
webdriver.prototype.keys = function(keys, cb) {

@@ -948,2 +1395,7 @@ if (!(keys instanceof Array)) {keys = [keys];}

/**
* clear(element, cb) -> cb(err)
*
* @jsonWire POST /session/:sessionId/element/:id/clear
*/
webdriver.prototype.clear = function(element, cb) {

@@ -957,2 +1409,7 @@ this._jsonWireCall({

/**
* title(cb) -> cb(err, title)
*
* @jsonWire GET /session/:sessionId/title
*/
webdriver.prototype.title = function(cb) {

@@ -975,3 +1432,9 @@ this._jsonWireCall({

// element is specific element, 'body', or undefined
/**
* text(element, cb) -> (err, text)
* element: specific element, 'body', or undefined
*
* @jsonWire GET /session/:sessionId/element/:id/text
* @docOrder 1
*/
webdriver.prototype.text = function(element, cb) {

@@ -988,3 +1451,10 @@ var _this = this;

// element is specific element, 'body', or undefined
/**
* Check if text is present:
* textPresent(searchText, element, cb) -> (err, boolean)
* element: specific element, 'body', or undefined
*
* @jsonWire GET /session/:sessionId/element/:id/text
* @docOrder 3
*/
webdriver.prototype.textPresent = function(searchText, element, cb) {

@@ -1000,2 +1470,7 @@ this.text.apply(this, [element, function(err, text) {

/**
* acceptAlert(cb) -> cb(err)
*
* @jsonWire POST /session/:sessionId/accept_alert
*/
webdriver.prototype.acceptAlert = function(cb) {

@@ -1009,2 +1484,7 @@ this._jsonWireCall({

/**
* dismissAlert(cb) -> cb(err)
*
* @jsonWire POST /session/:sessionId/dismiss_alert
*/
webdriver.prototype.dismissAlert = function(cb) {

@@ -1018,2 +1498,7 @@ this._jsonWireCall({

/**
* active(cb) -> cb(err, element)
*
* @jsonWire POST /session/:sessionId/element/active
*/
webdriver.prototype.active = function(cb) {

@@ -1032,2 +1517,7 @@ var _this = this;

/**
* url(cb) -> cb(err, url)
*
* @jsonWire GET /session/:sessionId/url
*/
webdriver.prototype.url = function(cb) {

@@ -1041,2 +1531,7 @@ this._jsonWireCall({

/**
* allCookies() -> cb(err, cookies)
*
* @jsonWire GET /session/:sessionId/cookie
*/
webdriver.prototype.allCookies = function(cb) {

@@ -1050,8 +1545,11 @@ this._jsonWireCall({

/*
cookie like the following:
{name:'fruit', value:'apple'}
optional fields: path, domain, secure, expiry
check the JsonWire doc for details
*/
/**
* setCookie(cookie, cb) -> cb(err)
* cookie example:
* {name:'fruit', value:'apple'}
* Optional cookie fields:
* path, domain, secure, expiry
*
* @jsonWire POST /session/:sessionId/cookie
*/
webdriver.prototype.setCookie = function(cookie, cb) {

@@ -1072,2 +1570,7 @@ // setting secure otherwise selenium server throws

/**
* deleteAllCookies(cb) -> cb(err)
*
* @jsonWire DELETE /session/:sessionId/cookie
*/
webdriver.prototype.deleteAllCookies = function(cb) {

@@ -1081,2 +1584,7 @@ this._jsonWireCall({

/**
* deleteCookie(name, cb) -> cb(err)
*
* @jsonWire DELETE /session/:sessionId/cookie/:name
*/
webdriver.prototype.deleteCookie = function(name, cb) {

@@ -1090,72 +1598,40 @@ this._jsonWireCall({

webdriver.prototype.isVisible = function(queryType, querySelector, callback){
var _isVisible1 = function(element , cb){
this.getComputedCSS(element, "display", function(err, display){
if(err){
return cb(err);
}
cb(null, display !== "none");
});
}
// deprecated
var _isVisible2 = function(queryType, querySelector, cb){
this.elementIfExists(queryType, querySelector, function(err, element){
if(err){
return callback(err);
return cb(err);
}
if(element == null){
return callback(null, false);
return cb(null, false);
}
element.getComputedCSS("display", function(err, display){
if(err){
return callback(err);
}
callback(null, display !== "none");
});
element.isVisible(cb);
});
}
webdriver.prototype.waitForElement = function(queryType, querySelector, timeout, callback){
var _this = this;
var endTime = Date.now() + timeout;
var poll = function(){
_this.hasElement(queryType, querySelector, function(err, isHere){
if(err){
return callback(err);
}
if(isHere){
callback();
} else {
if(Date.now() > endTime){
callback(new Error("Element didn't appear"));
} else {
setTimeout(poll, 200);
}
}
});
/**
* isVisible(element , cb) -> cb(err, boolean)
* deprecated: isVisible(queryType, querySelector, cb) -> cb(err, boolean)
*/
webdriver.prototype.isVisible = function() {
var args;
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
if (args.length <= 2) {
return _isVisible1.apply(this, args);
} else {
return _isVisible2.apply(this, args);
}
};
poll();
}
webdriver.prototype.waitForVisible = function(queryType, querySelector, timeout, callback) {
var _this = this;
var endTime = Date.now() + timeout;
var poll = function(){
_this.isVisible(queryType, querySelector, function(err, visible) {
if (err) {
return callback(err);
}
if (visible) {
callback();
} else {
if (Date.now() > endTime) {
callback(new Error("Element didn't become visible"));
} else {
setTimeout(poll, 200);
}
}
});
}
poll();
}
// waitForCondition recursive implementation

@@ -1194,4 +1670,12 @@ webdriver.prototype._waitForConditionImpl = function(conditionExpr, limit, poll, cb) {

// args: (conditionExpr, timeout, poll, cb)
// timeout and poll are optional
/**
* Waits for JavaScript condition to be true (polling within wd client):
* waitForCondition(conditionExpr, timeout, pollFreq, cb) -> cb(err, boolean)
* waitForCondition(conditionExpr, timeout, cb) -> cb(err, boolean)
* waitForCondition(conditionExpr, cb) -> cb(err, boolean)
* conditionExpr: condition expression, should return a boolean
* timeout: timeout (optional, default: 1000)
* pollFreq: pooling frequency (optional, default: 100)
* return true if condition satisfied, error otherwise.
*/
webdriver.prototype.waitForCondition = function() {

@@ -1219,4 +1703,12 @@ var _this = this;

// args: (conditionExpr, timeout, poll, cb)
// timeout and poll are optional
/**
* Waits for JavaScript condition to be true (async script polling within browser):
* waitForConditionInBrowser(conditionExpr, timeout, pollFreq, cb) -> cb(err, boolean)
* waitForConditionInBrowser(conditionExpr, timeout, cb) -> cb(err, boolean)
* waitForConditionInBrowser(conditionExpr, cb) -> cb(err, boolean)
* conditionExpr: condition expression, should return a boolean
* timeout: timeout (optional, default: 1000)
* pollFreq: pooling frequency (optional, default: 100)
* return true if condition satisfied, error otherwise.
*/
webdriver.prototype.waitForConditionInBrowser = function() {

@@ -1244,1 +1736,2 @@ var _this = this;

};

7

package.json

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

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

@@ -26,5 +26,8 @@ , "repository" :

,"express": "2.x"
,"gleak": "latest"
,"imageinfo": "latest"
,"covershot": "latest"
,"nock": "latest"
,"dox": "latest"
,"mu2": "latest"
,"underscore": "latest"
}

@@ -31,0 +34,0 @@ , "scripts" : {

@@ -94,533 +94,1501 @@ # WD.js -- A light weight WebDriver/Se2 client for node.js

</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
GET&nbsp;<a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#GET_/status">/status</a><br>
Query the server's current status.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
status(cb) -> cb(err, status)
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST&nbsp;<a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session">/session</a><br>
Create a new session.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
init(desired, cb) -> cb(err, sessionID)
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
GET&nbsp;<a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#GET_/sessions">/sessions</a><br>
Returns a list of the currently active sessions.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
<ul>
<li>all sessions: sessions(cb) -> cb(err, sessions)</li>
<li>
current session: <br>
altSessionCapabilities(cb) -> cb(err, capabilities)
</li>
</ul>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
GET&nbsp;<a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#GET_/session/:sessionId">/session/:sessionId</a><br>
Retrieve the capabilities of the specified session.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
sessionCapabilities(cb) -> cb(err, capabilities)
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
DELETE&nbsp;<a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#DELETE_/session/:sessionId">/session/:sessionId</a><br>
Delete the session.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
quit(cb) -> cb(err)
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST&nbsp;<a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/timeouts">/session/:sessionId/timeouts</a><br>
Configure the amount of time that a particular type of operation can execute for before they are aborted and a |Timeout| error is returned to the client.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
<ul>
<li>
configurable type: NA (but setImplicitWaitTimeout and
setAsyncScriptTimeout do the same)
</li>
<li>
page load timeout: <br>
setPageLoadTimeout(ms, cb) -> cb(err)
</li>
</ul>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST&nbsp;<a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/timeouts/async_script">/session/:sessionId/timeouts/async_script</a><br>
Set the amount of time, in milliseconds, that asynchronous scripts executed by <tt>/session/:sessionId/execute_async</tt> are permitted to run before they are aborted and a |Timeout| error is returned to the client.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
setAsyncScriptTimeout(ms, cb) -> cb(err)
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST&nbsp;<a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/timeouts/implicit_wait">/session/:sessionId/timeouts/implicit_wait</a><br>
Set the amount of time the driver should wait when searching for elements.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
setImplicitWaitTimeout(ms, cb) -> cb(err)
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
GET&nbsp;<a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#GET_/session/:sessionId/url">/session/:sessionId/url</a><br>
Retrieve the URL of the current page.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
url(cb) -> cb(err, url)
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST&nbsp;<a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/url">/session/:sessionId/url</a><br>
Navigate to a new URL.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
get(url,cb) -> cb(err)
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST&nbsp;<a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/forward">/session/:sessionId/forward</a><br>
Navigate forwards in the browser history, if possible.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
forward(cb) -> cb(err)
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST&nbsp;<a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/back">/session/:sessionId/back</a><br>
Navigate backwards in the browser history, if possible.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
back(cb) -> cb(err)
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST&nbsp;<a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/refresh">/session/:sessionId/refresh</a><br>
Refresh the current page.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
refresh(cb) -> cb(err)
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST&nbsp;<a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/execute">/session/:sessionId/execute</a><br>
Inject a snippet of JavaScript into the page for execution in the context of the currently selected frame.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
<ul>
<li>
execute script: <br>
execute(code, args, cb) -> cb(err, value returned)
<ul>
<li>args is an optional Array</li>
</ul>
</li>
<li>
execute script using eval(code): <br>
safeExecute(code, args, cb) -> cb(err, value returned)
<ul>
<li>args is an optional Array</li>
</ul>
</li>
<li>
evaluate expression (using execute): <br>
eval(code, cb) -> cb(err, value)
</li>
<li>
evaluate expression (using safeExecute): <br>
safeEval(code, cb) -> cb(err, value)
</li>
</ul>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST&nbsp;<a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/execute_async">/session/:sessionId/execute_async</a><br>
Inject a snippet of JavaScript into the page for execution in the context of the currently selected frame.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
<ul>
<li>
execute async script: <br>
executeAsync(code, args, cb) -> cb(err, value returned)
<ul>
<li>args is an optional Array</li>
</ul>
</li>
<li>
execute async script using eval(code): <br>
safeExecuteAsync(code, args, cb) -> cb(err, value returned)
<ul>
<li>args is an optional Array</li>
</ul>
</li>
</ul>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST&nbsp;<a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/window">/session/:sessionId/window</a><br>
Select a particular browser window by name or selenium handle (see .windowHandles).
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
window(name, cb) -> cb(err)
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
DELETE&nbsp;<a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#DELETE_/session/:sessionId/window">/session/:sessionId/window</a><br>
Close the current window.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
close(cb) -> cb(err)
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
GET&nbsp;<a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#GET_/session/:sessionId/window_handles">/session/:sessionId/window_handles</a><br>
Get a list of all window handles in this session.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
windowHandles(cb) -> cb(err, arrayOfHandles)
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
GET&nbsp;<a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#GET_/session/:sessionId/cookie">/session/:sessionId/cookie</a><br>
Retrieve all cookies visible to the current page.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
allCookies() -> cb(err, cookies)
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST&nbsp;<a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/cookie">/session/:sessionId/cookie</a><br>
Set a cookie.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
setCookie(cookie, cb) -> cb(err)
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
DELETE&nbsp;<a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#DELETE_/session/:sessionId/cookie">/session/:sessionId/cookie</a><br>
Delete all cookies visible to the current page.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
deleteAllCookies(cb) -> cb(err)
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
DELETE&nbsp;<a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#DELETE_/session/:sessionId/cookie/:name">/session/:sessionId/cookie/:name</a><br>
Delete the cookie with the given name.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
deleteCookie(name, cb) -> cb(err)
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
GET&nbsp;<a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#GET_/session/:sessionId/title">/session/:sessionId/title</a><br>
Get the current page title.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
title(cb) -> cb(err, title)
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST&nbsp;<a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/element">/session/:sessionId/element</a><br>
Search for an element on the page, starting from the document root.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
<ul>
<li>
element(using, value, cb) -> cb(err, element) <br>
</li>
<li>
element<i>suffix</i>(value, cb) -> cb(err, element) <br>
<i>suffix:
ByClassName, ByCssSelector, ById,
ByName, ByLinkText, ByPartialLinkText,
ByTagName, ByXPath, ByCss</i>
</li>
<li>
see also hasElement, hasElement<i>suffix</i>, elementOrNull, element<i>suffix</i>OrNull,
elementIfExists, element<i>suffix</i>IfExists, in the elements section.
</li>
<ul>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST&nbsp;<a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/elements">/session/:sessionId/elements</a><br>
Search for multiple elements on the page, starting from the document root.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
<ul>
<li>
elements(using, value, cb) -> cb(err, elements) <br>
</li>
<li>
elements<i>suffix</i>(value, cb) -> cb(err, elements) <br>
<i>suffix:
ByClassName, ByCssSelector, ById,
ByName, ByLinkText, ByPartialLinkText,
ByTagName, ByXPath, ByCss</i>
</li>
<li>
hasElement(using, value, cb) -> cb(err, boolean) <br>
</li>
<li>
hasElement<i>suffix</i>(value, cb) -> cb(err, boolean) <br>
<i>suffix:
ByClassName, ByCssSelector, ById,
ByName, ByLinkText, ByPartialLinkText,
ByTagName, ByXPath, ByCss</i>
</li>
<li>
elementOrNull(using, value, cb) -> cb(err, element) <br>
(avoids not found error throw and returns null instead)
</li>
<li>
element<i>suffix</i>OrNull(value, cb) -> cb(err, element) <br>
(avoids not found error throw and returns null instead) <br>
<i>suffix:
ByClassName, ByCssSelector, ById,
ByName, ByLinkText, ByPartialLinkText,
ByTagName, ByXPath, ByCss</i>
</li>
<li>
elementIfExists(using, value, cb) -> cb(err, element) <br>
(avoids not found error throw and returns undefined instead)
</li>
<li>
element<i>suffix</i>IfExists(value, cb) -> cb(err, element) <br>
(avoids not found error throw and returns undefined instead) <br>
<i>suffix:
ByClassName, ByCssSelector, ById,
ByName, ByLinkText, ByPartialLinkText,
ByTagName, ByXPath, ByCss</i>
</li>
<ul>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST&nbsp;<a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/element/active">/session/:sessionId/element/active</a><br>
Get the element on the page that currently has focus.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
active(cb) -> cb(err, element)
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST&nbsp;<a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/element/:id/click">/session/:sessionId/element/:id/click</a><br>
Click on an element.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
clickElement(element, cb) -> cb(err)
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST&nbsp;<a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/displayed">/session/:sessionId/element/:id/displayed</a><br>
Determine if an element is currently displayed
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
displayed(cb) -> cb(err, displayed)
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
GET&nbsp;<a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#GET_/session/:sessionId/element/:id/text">/session/:sessionId/element/:id/text</a><br>
Returns the visible text for the element.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
<ul>
<li>
text(element, cb) -> (err, text)
</li>
<li>
textPresent(searchText, element, cb) -> (err, boolean)
</li>
</ul>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST&nbsp;<a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/element/:id/value">/session/:sessionId/element/:id/value</a><br>
Send a sequence of key strokes to an element.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
<ul>
<li>
type(element, keys, cb) -> cb(err)
</li>
<li>
special key map: wd.SPECIAL_KEYS (see lib/special-keys.js)
</li>
</ul>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST&nbsp;<a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/keys">/session/:sessionId/keys</a><br>
Send a sequence of key strokes to the active element.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
<ul>
<li>
keys(keys, cb) -> cb(err)
</li>
<li>
special key map: wd.SPECIAL_KEYS (see lib/special-keys.js)
</li>
</ul>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST&nbsp;<a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/element/:id/clear">/session/:sessionId/element/:id/clear</a><br>
Clear a <tt>TEXTAREA</tt> or <tt>text INPUT</tt> element's value.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
clear(element, cb) -> cb(err)
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
GET&nbsp;<a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#GET_/session/:sessionId/element/:id/attribute/:name">/session/:sessionId/element/:id/attribute/:name</a><br>
Get the value of an element's attribute.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
<ul>
<li>
getAttribute(element, attrName, cb) -> cb(err, value)
</li>
<li>
getValue(element, cb) -> cb(err, value)
</li>
</ul>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST&nbsp;<a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/accept_alert">/session/:sessionId/accept_alert</a><br>
Accepts the currently displayed alert dialog.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
acceptAlert(cb) -> cb(err)
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST&nbsp;<a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/dismiss_alert">/session/:sessionId/dismiss_alert</a><br>
Dismisses the currently displayed alert dialog.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
dismissAlert(cb) -> cb(err)
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST&nbsp;<a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/moveto">/session/:sessionId/moveto</a><br>
Move the mouse by an offset of the specificed element.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
moveTo(element, xoffset, yoffset, cb) -> cb(err)
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST&nbsp;<a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/click">/session/:sessionId/click</a><br>
Click any mouse button (at the coordinates set by the last moveto command).
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
click(button, cb) -> cb(err) <br>
buttons: {left: 0, middle: 1 , right: 2}
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST&nbsp;<a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/buttondown">/session/:sessionId/buttondown</a><br>
Click and hold the left mouse button (at the coordinates set by the last moveto command).
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
buttonDown(cb) -> cb(err)
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST&nbsp;<a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/buttonup">/session/:sessionId/buttonup</a><br>
Releases the mouse button previously held (where the mouse is currently at).
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
buttonUp(cb) -> cb(err)
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST&nbsp;<a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/doubleclick">/session/:sessionId/doubleclick</a><br>
Double-clicks at the current mouse coordinates (set by moveto).
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
doubleclick(cb) -> cb(err) <br>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
EXTRA: waitForCondition<br>
Waits for JavaScript condition to be true (polling within wd client).
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
waitForCondition(conditionExpr, timeout, pollFreq, cb) -> cb(err, boolean)
<ul>
<li>conditionExpr should return a boolean</li>
<li>timeout and pollFreq are optional (default: 1000, 100).</li>
<li>return true if condition satisfied, error otherwise.</li>
</ul>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
EXTRA: waitForConditionInBrowser<br>
Waits for JavaScript condition to be true. (async script polling within browser)
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
waitForConditionInBrowser(conditionExpr, timeout, pollFreq, cb) -> cb(err, boolean)
<ul>
<li>setAsyncScriptTimeout must be set to value higher than timeout</li>
<li>conditionExpr should return a boolean</li>
<li>timeout and pollFreq are optional (default: 1000, 100).</li>
<li>return true if condition satisfied, error otherwise.</li>
</ul>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
GET <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#GET_/status">/status</a><br>
Query the server's current status.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
status(cb) -&gt; cb(err, status)<br>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session">/session</a><br>
Create a new session.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
init(desired, cb) -&gt; cb(err, sessionID)<br>
Initialize the browser.<br>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
GET <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#GET_/sessions">/sessions</a><br>
Returns a list of the currently active sessions.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
<p>
sessions(cb) -&gt; cb(err, sessions)<br>
</p>
<p>
Alternate strategy to get session capabilities from server session list: <br>
altSessionCapabilities(cb) -&gt; cb(err, capabilities)<br>
</p>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
GET <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#GET_/session/:sessionId">/session/:sessionId</a><br>
Retrieve the capabilities of the specified session.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
sessionCapabilities(cb) -&gt; cb(err, capabilities)<br>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
DELETE <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#DELETE_/session/:sessionId">/session/:sessionId</a><br>
Delete the session.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
quit(cb) -&gt; cb(err)<br>
Destroy the browser.<br>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/timeouts">/session/:sessionId/timeouts</a><br>
Configure the amount of time that a particular type of operation can execute for before they are aborted and a |Timeout| error is returned to the client.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
setPageLoadTimeout(ms, cb) -&gt; cb(err)<br>
(use setImplicitWaitTimeout and setAsyncScriptTimeout to set the other timeouts)<br>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/timeouts/async_script">/session/:sessionId/timeouts/async_script</a><br>
Set the amount of time, in milliseconds, that asynchronous scripts executed by /session/:sessionId/execute_async are permitted to run before they are aborted and a |Timeout| error is returned to the client.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
setAsyncScriptTimeout(ms, cb) -&gt; cb(err)<br>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/timeouts/implicit_wait">/session/:sessionId/timeouts/implicit_wait</a><br>
Set the amount of time the driver should wait when searching for elements.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
setImplicitWaitTimeout(ms, cb) -&gt; cb(err)<br>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
GET <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#GET_/session/:sessionId/window_handle">/session/:sessionId/window_handle</a><br>
Retrieve the current window handle.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
windowHandle(cb) -&gt; cb(err, handle)<br>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
GET <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#GET_/session/:sessionId/window_handles">/session/:sessionId/window_handles</a><br>
Retrieve the list of all window handles available to the session.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
windowHandles(cb) -&gt; cb(err, arrayOfHandles)<br>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
GET <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#GET_/session/:sessionId/url">/session/:sessionId/url</a><br>
Retrieve the URL of the current page.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
url(cb) -&gt; cb(err, url)<br>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/url">/session/:sessionId/url</a><br>
Navigate to a new URL.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
get(url,cb) -&gt; cb(err)<br>
Get a new url.<br>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/forward">/session/:sessionId/forward</a><br>
Navigate forwards in the browser history, if possible.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
forward(cb) -&gt; cb(err)<br>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/back">/session/:sessionId/back</a><br>
Navigate backwards in the browser history, if possible.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
back(cb) -&gt; cb(err)<br>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/refresh">/session/:sessionId/refresh</a><br>
Refresh the current page.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
refresh(cb) -&gt; cb(err)<br>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/execute">/session/:sessionId/execute</a><br>
Inject a snippet of JavaScript into the page for execution in the context of the currently selected frame.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
<p>
execute(code, args, cb) -&gt; cb(err, value returned)<br>
execute(code, cb) -&gt; cb(err, value returned)<br>
args: script argument array (optional)<br>
<br>
</p>
<p>
Execute script using eval(code): <br>
safeExecute(code, args, cb) -&gt; cb(err, value returned)<br>
safeExecute(code, cb) -&gt; cb(err, value returned)<br>
args: script argument array (optional)<br>
<br>
</p>
<p>
Evaluate expression (using execute): <br>
eval(code, cb) -&gt; cb(err, value)<br>
</p>
<p>
Evaluate expression (using safeExecute): <br>
safeEval(code, cb) -&gt; cb(err, value)<br>
</p>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/execute_async">/session/:sessionId/execute_async</a><br>
Inject a snippet of JavaScript into the page for execution in the context of the currently selected frame.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
<p>
executeAsync(code, args, cb) -&gt; cb(err, value returned)<br>
executeAsync(code, cb) -&gt; cb(err, value returned)<br>
args: script argument array (optional)<br>
<br>
</p>
<p>
Execute async script using eval(code): <br>
safeExecuteAsync(code, args, cb) -&gt; cb(err, value returned)<br>
safeExecuteAsync(code, cb) -&gt; cb(err, value returned)<br>
args: script argument array (optional)<br>
</p>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
GET <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#GET_/session/:sessionId/screenshot">/session/:sessionId/screenshot</a><br>
Take a screenshot of the current page.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
takeScreenshot(cb) -&gt; cb(err, screenshot)<br>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/frame">/session/:sessionId/frame</a><br>
Change focus to another frame on the page.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
frame(frameRef, cb) -&gt; cb(err)<br>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/window">/session/:sessionId/window</a><br>
Change focus to another window.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
window(name, cb) -&gt; cb(err)<br>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
DELETE <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#DELETE_/session/:sessionId/window">/session/:sessionId/window</a><br>
Close the current window.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
close(cb) -&gt; cb(err)<br>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
GET <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#GET_/session/:sessionId/cookie">/session/:sessionId/cookie</a><br>
Retrieve all cookies visible to the current page.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
allCookies() -&gt; cb(err, cookies)<br>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/cookie">/session/:sessionId/cookie</a><br>
Set a cookie.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
setCookie(cookie, cb) -&gt; cb(err)<br>
cookie example: <br>
{name:'fruit', value:'apple'}<br>
Optional cookie fields: <br>
path, domain, secure, expiry<br>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
DELETE <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#DELETE_/session/:sessionId/cookie">/session/:sessionId/cookie</a><br>
Delete all cookies visible to the current page.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
deleteAllCookies(cb) -&gt; cb(err)<br>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
DELETE <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#DELETE_/session/:sessionId/cookie/:name">/session/:sessionId/cookie/:name</a><br>
Delete the cookie with the given name.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
deleteCookie(name, cb) -&gt; cb(err)<br>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
GET <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#GET_/session/:sessionId/title">/session/:sessionId/title</a><br>
Get the current page title.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
title(cb) -&gt; cb(err, title)<br>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/element">/session/:sessionId/element</a><br>
Search for an element on the page, starting from the document root.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
<p>
element(using, value, cb) -&gt; cb(err, element)<br>
</p>
<p>
elementByClassName(value, cb) -&gt; cb(err, element)<br>
elementByCssSelector(value, cb) -&gt; cb(err, element)<br>
elementById(value, cb) -&gt; cb(err, element)<br>
elementByName(value, cb) -&gt; cb(err, element)<br>
elementByLinkText(value, cb) -&gt; cb(err, element)<br>
elementByPartialLinkText(value, cb) -&gt; cb(err, element)<br>
elementByTagName(value, cb) -&gt; cb(err, element)<br>
elementByXPath(value, cb) -&gt; cb(err, element)<br>
elementByCss(value, cb) -&gt; cb(err, element)<br>
</p>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/elements">/session/:sessionId/elements</a><br>
Search for multiple elements on the page, starting from the document root.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
<p>
elements(using, value, cb) -&gt; cb(err, elements)<br>
</p>
<p>
elementsByClassName(value, cb) -&gt; cb(err, elements) <br>
elementsByCssSelector(value, cb) -&gt; cb(err, elements) <br>
elementsById(value, cb) -&gt; cb(err, elements) <br>
elementsByName(value, cb) -&gt; cb(err, elements) <br>
elementsByLinkText(value, cb) -&gt; cb(err, elements) <br>
elementsByPartialLinkText(value, cb) -&gt; cb(err, elements) <br>
elementsByTagName(value, cb) -&gt; cb(err, elements) <br>
elementsByXPath(value, cb) -&gt; cb(err, elements) <br>
elementsByCss(value, cb) -&gt; cb(err, elements) <br>
</p>
<p>
Retrieve an element avoiding not found exception and returning null instead: <br>
elementOrNull(using, value, cb) -&gt; cb(err, element)<br>
</p>
<p>
elementByClassNameOrNull(value, cb) -&gt; cb(err, element)<br>
elementByCssSelectorOrNull(value, cb) -&gt; cb(err, element)<br>
elementByIdOrNull(value, cb) -&gt; cb(err, element)<br>
elementByNameOrNull(value, cb) -&gt; cb(err, element)<br>
elementByLinkTextOrNull(value, cb) -&gt; cb(err, element)<br>
elementByPartialLinkTextOrNull(value, cb) -&gt; cb(err, element)<br>
elementByTagNameOrNull(value, cb) -&gt; cb(err, element)<br>
elementByXPathOrNull(value, cb) -&gt; cb(err, element)<br>
elementByCssOrNull(value, cb) -&gt; cb(err, element)<br>
</p>
<p>
Retrieve an element avoiding not found exception and returning undefined instead: <br>
elementIfExists(using, value, cb) -&gt; cb(err, element)<br>
</p>
<p>
elementByClassNameIfExists(value, cb) -&gt; cb(err, element)<br>
elementByCssSelectorIfExists(value, cb) -&gt; cb(err, element)<br>
elementByIdIfExists(value, cb) -&gt; cb(err, element)<br>
elementByNameIfExists(value, cb) -&gt; cb(err, element)<br>
elementByLinkTextIfExists(value, cb) -&gt; cb(err, element)<br>
elementByPartialLinkTextIfExists(value, cb) -&gt; cb(err, element)<br>
elementByTagNameIfExists(value, cb) -&gt; cb(err, element)<br>
elementByXPathIfExists(value, cb) -&gt; cb(err, element)<br>
elementByCssIfExists(value, cb) -&gt; cb(err, element)<br>
</p>
<p>
Check if element exists: <br>
hasElement(using, value, cb) -&gt; cb(err, boolean)<br>
</p>
<p>
hasElementByClassName(value, cb) -&gt; cb(err, boolean) <br>
hasElementByCssSelector(value, cb) -&gt; cb(err, boolean) <br>
hasElementById(value, cb) -&gt; cb(err, boolean) <br>
hasElementByName(value, cb) -&gt; cb(err, boolean) <br>
hasElementByLinkText(value, cb) -&gt; cb(err, boolean) <br>
hasElementByPartialLinkText(value, cb) -&gt; cb(err, boolean) <br>
hasElementByTagName(value, cb) -&gt; cb(err, boolean) <br>
hasElementByXPath(value, cb) -&gt; cb(err, boolean) <br>
hasElementByCss(value, cb) -&gt; cb(err, boolean) <br>
</p>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/element/active">/session/:sessionId/element/active</a><br>
Get the element on the page that currently has focus.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
active(cb) -&gt; cb(err, element)<br>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/element/:id/click">/session/:sessionId/element/:id/click</a><br>
Click on an element.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
<p>
clickElement(element, cb) -&gt; cb(err)<br>
</p>
<p>
element.click(cb) -&gt; cb(err)<br>
</p>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
GET <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#GET_/session/:sessionId/element/:id/text">/session/:sessionId/element/:id/text</a><br>
Returns the visible text for the element.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
<p>
text(element, cb) -&gt; (err, text)<br>
element: specific element, 'body', or undefined<br>
</p>
<p>
element.text(cb) -&gt; (err, text)<br>
</p>
<p>
Check if text is present: <br>
textPresent(searchText, element, cb) -&gt; (err, boolean)<br>
element: specific element, 'body', or undefined<br>
<br>
</p>
<p>
element.textPresent(searchText, cb) -&gt; (err, boolean)<br>
<br>
</p>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/element/:id/value">/session/:sessionId/element/:id/value</a><br>
Send a sequence of key strokes to an element.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
<p>
type(element, keys, cb) -&gt; cb(err)<br>
Type keys (all keys are up at the end of command).<br>
special key map: wd.SPECIAL_KEYS (see lib/special-keys.js)<br>
</p>
<p>
element.type(keys, cb) -&gt; cb(err)<br>
</p>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/keys">/session/:sessionId/keys</a><br>
Send a sequence of key strokes to the active element.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
keys(keys, cb) -&gt; cb(err)<br>
Press keys (keys may still be down at the end of command).<br>
special key map: wd.SPECIAL_KEYS (see lib/special-keys.js)<br>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
GET <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#GET_/session/:sessionId/element/:id/name">/session/:sessionId/element/:id/name</a><br>
Query for an element's tag name.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
<p>
getTagName(element, cb) -&gt; cb(err, name)<br>
</p>
<p>
element.getTagName(cb) -&gt; cb(err, name)<br>
</p>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/element/:id/clear">/session/:sessionId/element/:id/clear</a><br>
Clear a TEXTAREA or text INPUT element's value.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
<p>
clear(element, cb) -&gt; cb(err)<br>
</p>
<p>
element.clear(cb) -&gt; cb(err)<br>
</p>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
GET <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#GET_/session/:sessionId/element/:id/attribute/:name">/session/:sessionId/element/:id/attribute/:name</a><br>
Get the value of an element's attribute.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
<p>
getAttribute(element, attrName, cb) -&gt; cb(err, value)<br>
</p>
<p>
element.getAttribute(attrName, cb) -&gt; cb(err, value)<br>
</p>
<p>
Get element value (in value attribute): <br>
getValue(element, cb) -&gt; cb(err, value)<br>
</p>
<p>
element.getValue(cb) -&gt; cb(err, value)<br>
</p>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
GET <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#GET_/session/:sessionId/element/:id/displayed">/session/:sessionId/element/:id/displayed</a><br>
Determine if an element is currently displayed.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
<p>
isDisplayed(element, cb) -&gt; cb(err, displayed)<br>
</p>
<p>
element.isDisplayed(cb) -&gt; cb(err, displayed)<br>
</p>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
GET <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#GET_/session/:sessionId/element/:id/css/:propertyName">/session/:sessionId/element/:id/css/:propertyName</a><br>
Query the value of an element's computed CSS property.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
<p>
getComputedCss(element, cssProperty , cb) -&gt; cb(err, value)<br>
</p>
<p>
element.getComputedCss(cssProperty , cb) -&gt; cb(err, value)<br>
</p>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/accept_alert">/session/:sessionId/accept_alert</a><br>
Accepts the currently displayed alert dialog.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
acceptAlert(cb) -&gt; cb(err)<br>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/dismiss_alert">/session/:sessionId/dismiss_alert</a><br>
Dismisses the currently displayed alert dialog.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
dismissAlert(cb) -&gt; cb(err)<br>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/moveto">/session/:sessionId/moveto</a><br>
Move the mouse by an offset of the specificed element.
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
moveTo(element, xoffset, yoffset, cb) -&gt; cb(err)<br>
Move to element, xoffset and y offset are optional.<br>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/click">/session/:sessionId/click</a><br>
Click any mouse button (at the coordinates set by the last moveto command).
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
click(button, cb) -&gt; cb(err)<br>
Click on current element.<br>
Buttons: {left: 0, middle: 1 , right: 2}<br>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/buttondown">/session/:sessionId/buttondown</a><br>
Click and hold the left mouse button (at the coordinates set by the last moveto command).
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
buttonDown(cb) -&gt; cb(err)<br>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/buttonup">/session/:sessionId/buttonup</a><br>
Releases the mouse button previously held (where the mouse is currently at).
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
buttonUp(cb) -&gt; cb(err)<br>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
POST <a href="http://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/doubleclick">/session/:sessionId/doubleclick</a><br>
Double-clicks at the current mouse coordinates (set by moveto).
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
doubleclick(cb) -&gt; cb(err) <br>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
EXTRA
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
Opens a new window (using Javascript window.open):<br>
newWindow(url, name, cb) -&gt; cb(err)<br>
newWindow(url, cb) -&gt; cb(err)<br>
name: optional window name<br>
Window can later be accessed by name with the window method, <br>
or by getting the last handle returned by the windowHandles method.<br>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
EXTRA
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
windowName(cb) -&gt; cb(err, name)<br>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
EXTRA
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
waitForElement(using, value, timeout, cb) -&gt; cb(err)<br>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
EXTRA
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
waitForVisible(using, value, timeout, cb) -&gt; cb(err)<br>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
EXTRA
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
waitForElementByClassName(value, timeout, cb) -&gt; cb(err)<br>
waitForElementByCssSelector(value, timeout, cb) -&gt; cb(err)<br>
waitForElementById(value, timeout, cb) -&gt; cb(err)<br>
waitForElementByName(value, timeout, cb) -&gt; cb(err)<br>
waitForElementByLinkText(value, timeout, cb) -&gt; cb(err)<br>
waitForElementByPartialLinkText(value, timeout, cb) -&gt; cb(err)<br>
waitForElementByTagName(value, timeout, cb) -&gt; cb(err)<br>
waitForElementByXPath(value, timeout, cb) -&gt; cb(err)<br>
waitForElementByCss(value, timeout, cb) -&gt; cb(err)<br>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
EXTRA
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
waitForVisibleByClassName(value, timeout, cb) -&gt; cb(err)<br>
waitForVisibleByCssSelector(value, timeout, cb) -&gt; cb(err)<br>
waitForVisibleById(value, timeout, cb) -&gt; cb(err)<br>
waitForVisibleByName(value, timeout, cb) -&gt; cb(err)<br>
waitForVisibleByLinkText(value, timeout, cb) -&gt; cb(err)<br>
waitForVisibleByPartialLinkText(value, timeout, cb) -&gt; cb(err)<br>
waitForVisibleByTagName(value, timeout, cb) -&gt; cb(err)<br>
waitForVisibleByXPath(value, timeout, cb) -&gt; cb(err)<br>
waitForVisibleByCss(value, timeout, cb) -&gt; cb(err)<br>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
EXTRA
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
isVisible(element , cb) -&gt; cb(err, boolean)<br>
deprecated: isVisible(queryType, querySelector, cb) -&gt; cb(err, boolean)<br>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
EXTRA
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
Waits for JavaScript condition to be true (polling within wd client): <br>
waitForCondition(conditionExpr, timeout, pollFreq, cb) -&gt; cb(err, boolean)<br>
waitForCondition(conditionExpr, timeout, cb) -&gt; cb(err, boolean)<br>
waitForCondition(conditionExpr, cb) -&gt; cb(err, boolean)<br>
conditionExpr: condition expression, should return a boolean<br>
timeout: timeout (optional, default: 1000) <br>
pollFreq: pooling frequency (optional, default: 100)<br>
return true if condition satisfied, error otherwise.<br>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
EXTRA
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
Waits for JavaScript condition to be true (async script polling within browser): <br>
waitForConditionInBrowser(conditionExpr, timeout, pollFreq, cb) -&gt; cb(err, boolean)<br>
waitForConditionInBrowser(conditionExpr, timeout, cb) -&gt; cb(err, boolean)<br>
waitForConditionInBrowser(conditionExpr, cb) -&gt; cb(err, boolean)<br>
conditionExpr: condition expression, should return a boolean<br>
timeout: timeout (optional, default: 1000) <br>
pollFreq: pooling frequency (optional, default: 100)<br>
return true if condition satisfied, error otherwise.<br>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; padding: 5px;">
EXTRA
</td>
<td style="border: 1px solid #ccc; padding: 5px;">
isVisible(cb) -&gt; cb(err, boolean)<br>
</td>
</tr>
</tbody>

@@ -631,4 +1599,7 @@ </table>

[full mapping](https://github.com/sebv/wd/blob/master/doc/jsonwiremap-all.md)
[supported mapping](https://github.com/admc/wd/blob/master/doc/jsonwire-mapping.md)
[full mapping](https://github.com/admc/wd/blob/master/doc/jsonwire-full-mapping.md)
## More docs!

@@ -635,0 +1606,0 @@ <pre>

@@ -12,4 +12,3 @@ // Generated by CoffeeScript 1.3.3

test = function(remoteWdConfig, desired) {
var browser, leakDetector, wd;
leakDetector = (require('../common/leak-detector'))();
var browser, wd;
wd = require('./wd-with-cov');

@@ -69,3 +68,3 @@ if (typeof remoteWdConfig === 'function') {

});
describe("leaving", function() {
return describe("leaving", function() {
return it("closing browser", function(done) {

@@ -78,5 +77,2 @@ this.timeout(TIMEOUT);

});
if (process.env.WD_COV == null) {
return leakDetector.lookForLeaks();
}
};

@@ -83,0 +79,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

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