Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

webdriverjs

Package Overview
Dependencies
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webdriverjs - npm Package Compare versions

Comparing version 1.0.6 to 1.1.0

.editorconfig

38

lib/commands/buttonClick.js

@@ -1,34 +0,4 @@

module.exports = function buttonClick (cssSelector, callback) {
var self = this;
this.element(cssSelector, function(err,result){
if(err === null && result.value){
self.moveTo(result.value.ELEMENT, function(err,result){
if(err === null) {
self.buttonDown(function(){
if(err === null) {
self.buttonUp(callback);
} else {
callback(err, result);
}
});
} else {
callback(err, result);
}
});
} else {
callback(err, result);
}
});
};
// Deprecated but included for backward compatibility. Alias for 'click' command.
module.exports = function buttonClick () {
return this.click.apply(this, arguments);
}
var clickHelper = require('../helpers/click');
module.exports = function click (cssSelector, callback) {
var self = this;

@@ -6,0 +5,0 @@

module.exports = function dragAndDrop (cssSelectorItem, cssSelectorDropDestination, callback) {
var self = this;
this

@@ -6,0 +4,0 @@ .moveToObject(cssSelectorItem)

@@ -1,10 +0,11 @@

module.exports = function buttonDown (callback) {
var handleMouseButtonProtocol = require('../helpers/handleMouseButtonProtocol');
var requestOptions = {
path:"/session/:sessionId/buttondown",
method:"POST"
};
module.exports = function buttonDown (button, callback) {
this.requestHandler.create(requestOptions,{},callback);
handleMouseButtonProtocol.call(
this,
"/session/:sessionId/buttondown",
button, callback
);
};

@@ -1,10 +0,11 @@

module.exports = function buttonUp (callback) {
var handleMouseButtonProtocol = require('../helpers/handleMouseButtonProtocol');
var requestOptions = {
path:"/session/:sessionId/buttonup",
method:"POST"
};
module.exports = function buttonUp (button, callback) {
this.requestHandler.create(requestOptions,{},callback);
handleMouseButtonProtocol.call(
this,
"/session/:sessionId/buttonup",
button, callback
);
};

@@ -47,3 +47,2 @@ module.exports = function element (value, callback) {

this.requestHandler.create(requestOptions,{'using':using, 'value':value},callback);
};

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

var http = require("http");
module.exports = function moveTo (element, xoffset, yoffset, callback) {

@@ -7,3 +5,3 @@

if (typeof element === "string" && typeof element !== "function") {
if (typeof element === "string") {
data.element = element;

@@ -14,3 +12,3 @@ } else if (typeof element === "function") {

if (typeof xoffset === "number" && typeof xoffset !== "function") {
if (typeof xoffset === "number") {
data.xoffset = xoffset;

@@ -21,3 +19,3 @@ } else if (typeof xoffset === "function") {

if (typeof yoffset === "number" && typeof yoffset !== "function") {
if (typeof yoffset === "number") {
data.yoffset = yoffset;

@@ -24,0 +22,0 @@ } else if (typeof yoffset === "function") {

{
"name": "webdriverjs",
"description": "A nodejs bindings implementation for selenium 2.0/webdriver",
"version": "1.0.6",
"version": "1.1.0",
"homepage": "https://github.com/camme/webdriverjs",

@@ -35,3 +35,5 @@ "author": "camilo tapia <camilo.tapia@gmail.com>",

"mocha": "~1.15.1",
"chai": "~1.8.1"
"chai": "~1.8.1",
"request": "~2.30.0",
"jshint": "~2.4.1"
},

@@ -64,9 +66,6 @@ "tags": [

"dependencies": {
"lodash.assign": "~2.4.1",
"lodash.partial": "~2.4.1",
"chainit": "~1.1.2",
"lodash.merge": "~2.4.1",
"pragma-singleton": "~1.0.3",
"request": "~2.30.0"
"pragma-singleton": "~1.0.3"
}
}

@@ -158,3 +158,3 @@ Webdriver/selenium 2.0 javascript bindings for nodejs [![Build Status](https://travis-ci.org/camme/webdriverjs.png?branch=master)](https://travis-ci.org/camme/webdriverjs) [![Dependency Status](https://gemnasium.com/camme/webdriverjs.png)](https://gemnasium.com/camme/webdriverjs)

# serves the test directory holding the test files
http-server test
http-server

@@ -181,6 +181,5 @@ # runs tests !

- **addValue(`String` selector, `String|String[]` value, `Function` callback)**<br>adds a value to an object found by a selector. You can also use unicode characters like `Left arrow` or `Back space`. You'll find all supported characters [here](https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/value). To do that, the value has to correspond to a key from the table.
- **buttonClick(`String` selector, `Function` callback)**<br>click on a button using a selector
- **call(callback)**<br>call given function in async order of current command queue
- **clearElement(`String` selector, `Function` callback)**<br>clear an element of text
- **click(`String` selector, `Function` callback)**<br>Clicks on an element based on a selector
- **click(`String` selector, `Function` callback)**<br>Clicks on an element based on a selector.
- **close([`String` tab ID to focus on,] `Function` callback)**<br>Close the current window (optional: and switch focus to opended tab)

@@ -192,3 +191,3 @@ - **deleteCookie(`String` name, `Function` callback)**<br>Delete a cookie for current page.

- **endAll(`Function` callback)**<br>Ends all sessions (closes the browser)
- **execute(`String` script, `Array` arguments, `Function` callback)**<br>Inject a snippet of JavaScript into the page for execution in the context of the currently selected frame.
- **execute(`String` or `Function` script, `Array` arguments, `Function` callback)**<br>Inject a snippet of JavaScript into the page for execution in the context of the currently selected frame. If script is a `Function`, arguments is required.
- **getAttribute(`String` selector, `String` attribute name, `Function` callback)**<br>Get an attribute from an dom obj based on the selector and attribute name

@@ -209,2 +208,4 @@ - **getCookie(`String` name, `Function` callback)**<br>Gets the cookie for current page.

- **isVisible(`String` selector, `Function` callback)**<br>Return true or false if the selected dom obj is visible (found by selector)
- **leftClick(`String` selector, `Function` callback)**<br>Apply left click at an element. If selector is not provided, click at the last moved-to location.
- **middleClick(`String` selector, `Function` callback)**<br>Apply middle click at an element. If selector is not provided, click at the last moved-to location.
- **moveToObject(`String` selector, `Function` callback)**<br>Moves the page to the selected dom object

@@ -214,2 +215,3 @@ - **newWindow(`String` url, `String` name for the new window, `String` new window features (e.g. size, position, scrollbars, etc.), `Function` callback)**<br>equivalent function to `Window.open()` in a browser

- **refresh(`Function` callback)**<br>Refresh the current page
- **rightClick(`String` selector, `Function` callback)**<br>Apply right click at an element. If selector is not provided, click at the last moved-to location.
- **saveScreenshot(`String` path to file, `Function` callback)**<br>Saves a screenshot as a png from the current state of the browser

@@ -229,4 +231,5 @@ - **setCookie(`Object` cookie, `Function` callback)**<br>Sets a [cookie](http://code.google.com/p/selenium/wiki/JsonWireProtocol#Cookie_JSON_Object) for current page.

- [back](http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/back)
- [buttondown](http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/buttondown)
- [buttonup](http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/buttonup)
- [buttonPress](http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/click)
- [buttonDown](http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/buttondown)
- [buttonUp](http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/buttonup)
- [cookie](http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/cookie)

@@ -233,0 +236,0 @@ - [cookieName](http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/cookie/:name)

@@ -24,3 +24,3 @@ /* globals for tests */

if(
process.env.TRAVIS_BRANCH !== undefined && (
process.env.TRAVIS !== undefined && (
(process.env.TRAVIS_BRANCH === 'master' && process.env._BROWSER === 'phantomjs') ||

@@ -27,0 +27,0 @@ (process.env.TRAVIS_BRANCH !== 'master' && process.env._BROWSER !== 'phantomjs'))) {

@@ -1,73 +0,138 @@

describe('click command test',function() {
before(h.setup);
var clickAndConfirm = function(params) {
params.client
.isVisible(params.btnClass, function(err,result) {
assert.equal(err, null);
assert.ok(result);
})
.isVisible(params.confirmationClass, function(err, result) {
assert.equal(err, null);
assert.ok(!result, 'confirmation must be invisible as a precondition');
});
it('text should be visible after click on .btn1', function(done){
this.client
.isVisible('.btn1',function(err,result) {
assert.equal(null, err);
assert.ok(result);
if(params.moveBeforeClick) {
params.client
.moveToObject(params.btnClass, function(err, result) {
assert.equal(err, null);
})
.click('.btn1',function(err,result) {
assert.equal(null, err);
assert.equal(0, result.status);
})
.isVisible('.btn1_clicked',function(err,result){
assert.equal(null, err)
assert(result, '.btn1 was clicked');
})
.call(done);
[params.clickMethodName](function(err, result) {
assert.equal(err, null);
assert.equal(result.status, 0);
});
} else {
params.client
[params.clickMethodName](params.btnClass, function(err, result) {
assert.equal(err, null);
assert.equal(result.status, 0);
});
}
params.client
.isVisible(params.confirmationClass, function(err, result) {
assert.equal(err, null);
assert.equal(result, params.expectConfirmationVisible);
});
};
describe('left click commands',function() {
var testMouseClick = function(clickMethodName, moveBeforeClick) {
it('text should be visible after click on .btn1', function(done){
clickAndConfirm({
client: this.client,
clickMethodName: clickMethodName,
moveBeforeClick: moveBeforeClick,
btnClass: '.btn1',
confirmationClass: '.btn1_clicked',
expectConfirmationVisible: true,
});
this.client.call(done);
});
it('text should NOT be visible after click on .btn2 because button is disabled', function(done){
clickAndConfirm({
client: this.client,
clickMethodName: clickMethodName,
moveBeforeClick: moveBeforeClick,
btnClass: '.btn2',
confirmationClass: '.btn2_clicked',
expectConfirmationVisible: false,
});
this.client.call(done);
});
it('text should be visible after clicking on .btn4 1px/1px width/height', function(done){
clickAndConfirm({
client: this.client,
clickMethodName: clickMethodName,
moveBeforeClick: moveBeforeClick,
btnClass: '.btn4',
confirmationClass: '.btn4_clicked',
expectConfirmationVisible: true,
});
this.client.call(done);
});
};
var testEventClick = function(clickMethodName) {
it('text should be visible after click on .btn3 altought it is behind an overlay', function(done){
clickAndConfirm({
client: this.client,
clickMethodName: clickMethodName,
btnClass: '.btn3',
confirmationClass: '.btn3_clicked',
expectConfirmationVisible: true,
});
this.client.call(done);
});
};
beforeEach(h.setup);
['click', 'buttonClick'].forEach(function(clickMethodName) {
describe('`' + clickMethodName + '`', function() {
testMouseClick(clickMethodName);
testEventClick(clickMethodName);
});
});
it('text should NOT be visible after click on .btn2 because button is disabled', function(done){
this.client
.isVisible('.btn2',function(err,result) {
assert.equal(null, err);
assert.ok(result);
})
.click('.btn2',function(err,result) {
assert.equal(null, err);
assert.equal(0, result.status);
})
.isVisible('.btn2_clicked',function(err,result){
assert.equal(null, err)
assert(!result, '.btn2 was not clicked');
})
.call(done);
describe('`leftClick`', function() {
testMouseClick('leftClick');
testMouseClick('leftClick', true);
});
it('text should be visible after click on .btn3 altought it is behind an overlay', function(done){
this.client
.isVisible('.btn3',function(err,result) {
assert.equal(null, err);
assert.ok(result);
})
.click('.btn3',function(err,result) {
assert.equal(null, err);
assert.equal(0, result.status);
})
.isVisible('.btn3_clicked',function(err,result){
assert.equal(null, err);
assert(result, '.btn3 was clicked');
})
.call(done);
});
describe('rightclick', function() {
before(h.setup);
it('text should be visible after right-clicking on .btn1', function(done) {
clickAndConfirm({
client: this.client,
clickMethodName: 'rightClick',
btnClass: '.btn1',
confirmationClass: '.btn1_right_clicked',
expectConfirmationVisible: true,
});
this.client.call(done);
});
});
describe.skip('middleClick', function() {
before(h.setup);
it('text should be visible after clicking on .btn4 1px/1px width/height', function(done){
this.client
.isVisible('.btn4',function(err,result) {
assert.equal(null, err);
assert.ok(result);
})
.click('.btn4',function(err,result) {
assert.equal(null, err);
assert.equal(0, result.status);
})
.isVisible('.btn4_clicked',function(err,result){
assert.equal(null, err);
assert(result, '.btn4 was clicked');
})
.call(done);
// note this fails with most browsers: middle click becomes left click.
it('text should be visible after middle-clicking on .btn1', function(done) {
clickAndConfirm({
client: this.client,
clickMethodName: 'middleClick',
btnClass: '.btn1',
confirmationClass: '.btn1_middle_clicked',
expectConfirmationVisible: true,
});
this.client.call(done);
});
});
});

@@ -19,3 +19,3 @@ describe.skip('drag&drop command test', function() {

})
.buttonClick('.btn3',function(err,result) {
.click('.btn3',function(err,result) {
assert.equal(null, err);

@@ -22,0 +22,0 @@ assert.equal(0, result.status);

@@ -76,3 +76,3 @@ describe('Promises', function() {

})
.buttonClick('.btn1',function(err) {
.click('.btn1',function(err) {
assert.equal(null, err);

@@ -79,0 +79,0 @@ result += 'f';

@@ -5,15 +5,17 @@ var request = require('request');

it('it marks tests on saucelabs as passed/failed', function(done) {
// mark travis job as passed
var options = {
headers: { 'Content-Type': 'text/json' },
url: 'http://' + process.env.SAUCE_USERNAME + ':' + process.env.SAUCE_ACCESS_KEY + '@saucelabs.com/rest/v1/' + process.env.SAUCE_USERNAME + '/jobs/' + this.client.requestHandler.sessionID,
method: 'PUT',
body: JSON.stringify({
passed: true
})
};
if (process.env.TRAVIS !== undefined) {
it('it marks tests on saucelabs as passed/failed', function(done) {
// mark travis job as passed
var options = {
headers: { 'Content-Type': 'text/json' },
url: 'http://' + process.env.SAUCE_USERNAME + ':' + process.env.SAUCE_ACCESS_KEY + '@saucelabs.com/rest/v1/' + process.env.SAUCE_USERNAME + '/jobs/' + this.client.requestHandler.sessionID,
method: 'PUT',
body: JSON.stringify({
passed: true
})
};
request(options, done);
});
request(options, done);
});
}

@@ -20,0 +22,0 @@ it('stops the client', function(done) {

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