Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
webdriverjs
Advanced tools
A WebDriver module for nodejs. Either use the super easy help commands or use the base Webdriver wire protocol commands.
It is written so its easy to add new protocol implementations and add helper commands so make testing easier. Each command resides as one file inside the node module folder which makes it easy to extend.
The two main reasons for this projects are:
Ease of use - Writing tests with webdriver should be very easy
Easy to extend - Adding helper functions, or more complicated sets and combinations of existing commands, should also be very easy.
Either download it from github or use npm:
npm install webdriverjs
Run selenium server first:
java -jar node_modules/webdriverjs/bin/selenium-server-standalone-2.31.0.jar
Webdriverjs has just a few methods. Most of the methods you will use regurarly are the methods available from the client. To begin using Webdriverjs you just need to create a client. For testing you can use any nodejs test framework as well as any BDD/TDD assertion library.
describe('my webdriverjs tests', function(){
this.timeout(99999999);
var client = {};
before(function(){
client = webdriverjs.remote(options);
client.init();
});
it('Github test',function(done) {
client
.url('https://github.com/')
.getElementSize('.header-logo-wordmark', function(err, result) {
expect(err).to.be.null;
assert.strictEqual(result.height , 30);
assert.strictEqual(result.width, 94);
})
.getTitle(function(err, title) {
expect(err).to.be.null;
assert.strictEqual(title,'GitHub · Build software better, together.');
})
.getElementCssProperty('class name','subheading', 'color', function(err, result){
expect(err).to.be.null;
assert.strictEqual(result, 'rgba(136, 136, 136, 1)');
})
.call(done);
});
after(function(done) {
client.end(done);
});
});
See more examples with other libraries in the example directory.
Type: Object
Example:
browserName: 'chrome', // options: firefox, chrome, opera, safari
version: '27.0', // browser version
platform: 'XP', // OS platform
tags: ['tag1','tag2'], // specify some tags (e.g. if you use Sauce Labs)
name: 'my test' // set name for test (e.g. if you use Sauce Labs)
Type: String
Default: verbose
Options: verbose | silent | command | data | result
Create client as singleton instance for use in different files
Type: Boolean
Default: true
To run your tests via Sauce Labs, add the following attributes to your option object. If you have a public repository, never publish your Sauce Labs key! Export these informations as enviroment variables.
host: 'ondemand.saucelabs.com', // Sauce Labs remote host
user: 'webdriverjs', // your username
key: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX' // your account key
If you wish to end all sessions, you can call the endAll method:
require("webdriverjs").endAll(callback);
Where callback is an optional parameter. This method can be used if you run lots of tests, and you want to make sure that all sessions on your selenium server are closed when you are done. Usually its enough to close each client with its end() method, but if you, for some reason, want to make sure that no sessions are open, use endAll(). (note: this method is also available from the client returned from .remote() as well, but its the same as webdriverjs.endAll())
To get a list of all open sessions, you can call:
require("webdriverjs").sessions(callback);
which wil return an array with all sessions from selenium (note: this method is also available from the client returned from .remote() as well, but its the same as webdriverjs.sessions()).
If you which to extend with your own set of commands there is a method called addCommand available from the client object:
var client = require("webdriverjs").remote();
// create a command the returns the current url and title as one result
// just to show an example
client.addCommand("getUrlAndTitle", function(callback) {
this.url(function(err,urlResult) {
this.getTitle(function(err,titleResult) {
var specialResult = {url: urlResult.value, title: titleResult};
if (typeof callback == "function") {
callback(err,specialResult);
}
})
});
});
client
.init()
.url('http://www.github.com')
.getUrlAndTitle(function(err,result){
expect(err).to.be.null;
assert.strictEqual(result.url,'https://github.com/');
assert.strictEqual(result.title,'GitHub · Build software better, together.');
})
.end();
These are the current implemented helper methods. All methods take from 0 to a couple of parameters. Also all methods accept a callback so that we can assert values or have more logic when the callback is called.
String
css selector, String
value, Function
callback)Left arrow
or Back space
. You'll find all supported characters here. To do that, the value has to correspond to a key from the table.String
css selector, Function
callback)String
css selector, Function
callback)String
css selector, Function
callback)String
name, Function
callback)String
css selector, Function
callback)String
sourceCssSelector, String
destinationCssSelector, Function
callback)Function
callback)Function
callback)String
script, Array
arguments, Function
callback)String
css selector, String
attribute name, Function
callback)Function
callback)String
css selector, String
css property name, Function
callback)String
find by, String
finder, String
css property name, Function
callback)String
css selector, Function
callback)String
css selector, Function
callback)String
css selector, Function
callback)String
css selector, Function
callback)Function
callback)String
css selector, Function
callback)String
css selector, Function
callback)Function
callback)String
css selector, Function
callback)String
css selector, Function
callback)String
css selector, Function
callback)String
css selector, Function
callback)Integer
milliseconds, Function
callback)Function
callback)String
path to file, Function
callback)Object
cookie, Function
callback)String
css selector, String
value, Function
callback)Left arrow
or Back space
. You'll find all supported characters here. To do that, the value has to correspond to a key from the table.String
css selector, Function
callback)String
css selector, Integer
milliseconds, Function
callback)Here are the implemented bindings (and links to the official json protocol binding)
The npm module for this library is maintained by:
FAQs
A nodejs bindings implementation for selenium 2.0/webdriver
The npm package webdriverjs receives a total of 36 weekly downloads. As such, webdriverjs popularity was classified as not popular.
We found that webdriverjs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.