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.0.7

test/spec/element.js

64

lib/protocol/element.js

@@ -9,37 +9,43 @@ module.exports = function element (value, callback) {

// check value type
// use id strategy if value starts with # and doesnt contain any other CSS selector-relevant character
if(value.indexOf('#') === 0 && value.search(/(\s|>|\.|[|])/) === -1) {
using = 'id';
value = value.slice(1);
if (arguments.length === 3) {
using = arguments[0];
value = arguments[1];
callback = arguments[2];
} else {
// check value type
// use id strategy if value starts with # and doesnt contain any other CSS selector-relevant character
if(value.indexOf('#') === 0 && value.search(/(\s|>|\.|[|])/) === -1) {
using = 'id';
value = value.slice(1);
// use xPath startegy if value startes with //
} else if(value.indexOf('//') === 0) {
using = 'xpath';
// use xPath startegy if value startes with //
} else if(value.indexOf('//') === 0) {
using = 'xpath';
// use link text startegy if value startes with =
} else if(value.indexOf('=') === 0) {
using = 'link text';
value = value.slice(1);
// use link text startegy if value startes with =
} else if(value.indexOf('=') === 0) {
using = 'link text';
value = value.slice(1);
// use partial link text startegy if value startes with =*
} else if(value.indexOf('*=') === 0) {
using = 'partial link text';
value = value.slice(2);
// use partial link text startegy if value startes with =*
} else if(value.indexOf('*=') === 0) {
using = 'partial link text';
value = value.slice(2);
// use tag name strategy if value contains a tag
// e.g. "<div>" or "<div />"
} else if(value.search(/<[a-zA-Z-]+( \/)*>/g) >= 0) {
using = 'tag name';
value = value.replace(/<|>|\/|\s/g,'');
// use tag name strategy if value contains a tag
// e.g. "<div>" or "<div />"
} else if(value.search(/<[a-zA-Z-]+( \/)*>/g) >= 0) {
using = 'tag name';
value = value.replace(/<|>|\/|\s/g,'');
// use name strategy if value queries elements with name attributes
// e.g. "[name='myName']" or '[name="myName"]'
} else if(value.search(/\[name=("|')([a-zA-z0-9-_]+)("|')\]/) >= 0) {
using = 'name';
value = value.match(/\[name=("|')([a-zA-z0-9-_]+)("|')\]/)[2];
// use name strategy if value queries elements with name attributes
// e.g. "[name='myName']" or '[name="myName"]'
} else if(value.search(/\[name=("|')([a-zA-z0-9-_]+)("|')\]/) >= 0) {
using = 'name';
value = value.match(/\[name=("|')([a-zA-z0-9-_]+)("|')\]/)[2];
// if nothing fits with the supported strategies we fall back to the css selector strategy
} else {
using = 'css selector';
// if nothing fits with the supported strategies we fall back to the css selector strategy
} else {
using = 'css selector';
}
}

@@ -46,0 +52,0 @@

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

@@ -6,0 +6,0 @@ "author": "camilo tapia <camilo.tapia@gmail.com>",

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