@testim/testim-cli
Version:
Command line interface for running Testing on you CI
30 lines (22 loc) • 784 B
JavaScript
/**
*
* Click on an element.
*
* @param {String} ID ID of a WebElement JSON object to route the command to
*
* @see https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/click
* @type protocol
*
*/
var ErrorHandler = require('../utils/ErrorHandler.js');
module.exports = function elementIdClick (id) {
if(typeof id !== 'string' && typeof id !== 'number') {
throw new ErrorHandler.ProtocolError('number or type of arguments don\'t agree with elementIdClick protocol command');
}
var requestOptions = {
path: '/session/:sessionId/element/:id/click',
method: 'POST'
};
requestOptions.path = requestOptions.path.replace(/:id/gi, id);
return this.requestHandler.create(requestOptions);
};