Socket
Socket
Sign inDemoInstall

selenium-webdriver

Package Overview
Dependencies
Maintainers
8
Versions
99
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

selenium-webdriver - npm Package Compare versions

Comparing version 4.10.0 to 4.11.0

bidi/networkInspector.js

8

bidi/browsingContext.js

@@ -29,3 +29,3 @@ // Licensed to the Software Freedom Conservancy (SFC) under one

if (type != undefined && !['window', 'tab'].includes(type)) {
if (type !== undefined && !['window', 'tab'].includes(type)) {
throw Error(`Valid types are 'window' & 'tab'. Received: ${type}`)

@@ -36,3 +36,3 @@ }

this._id =
browsingContextId == undefined
browsingContextId === undefined
? (await this.create(type, referenceContext))['result']['context']

@@ -70,3 +70,3 @@ : browsingContextId

if (
readinessState != undefined &&
readinessState !== undefined &&
!['none', 'interactive', 'complete'].includes(readinessState)

@@ -123,3 +123,3 @@ ) {

/**
* Closes the browing context
* Closes the browsing context
* @returns {Promise<void>}

@@ -126,0 +126,0 @@ */

@@ -57,3 +57,3 @@ // Licensed to the Software Freedom Conservancy (SFC) under one

}
this._on(callback)
await this._on(callback)
}

@@ -60,0 +60,0 @@

@@ -57,6 +57,7 @@ // Licensed to the Software Freedom Conservancy (SFC) under one

* @param callback
* @param filterBy
* @returns {Promise<void>}
*/
async onConsoleEntry(callback, filterBy = undefined) {
if (filterBy != undefined && !(filterBy instanceof FilterBy)) {
if (filterBy !== undefined && !(filterBy instanceof FilterBy)) {
throw Error(`Pass valid FilterBy object. Received: ${filterBy}`)

@@ -82,3 +83,3 @@ }

if (filterBy != undefined) {
if (filterBy !== undefined) {
if (params?.level === filterBy.getLevel()) {

@@ -98,6 +99,7 @@ callback(consoleEntry)

* @param callback
* @param filterBy
* @returns {Promise<void>}
*/
async onJavascriptLog(callback, filterBy = undefined) {
if (filterBy != undefined && !(filterBy instanceof FilterBy)) {
if (filterBy !== undefined && !(filterBy instanceof FilterBy)) {
throw Error(`Pass valid FilterBy object. Received: ${filterBy}`)

@@ -120,3 +122,3 @@ }

if (filterBy != undefined) {
if (filterBy !== undefined) {
if (params?.level === filterBy.getLevel()) {

@@ -170,6 +172,7 @@ callback(jsEntry)

* @param callback
* @param filterBy
* @returns {Promise<void>}
*/
async onLog(callback, filterBy = undefined) {
if (filterBy != undefined && !(filterBy instanceof FilterBy)) {
if (filterBy !== undefined && !(filterBy instanceof FilterBy)) {
throw Error(`Pass valid FilterBy object. Received: ${filterBy}`)

@@ -191,3 +194,3 @@ }

if (filterBy != undefined) {
if (filterBy !== undefined) {
if (params?.level === filterBy.getLevel()) {

@@ -202,3 +205,3 @@ callback(jsEntry)

}
if (params?.type === 'console') {

@@ -215,4 +218,4 @@ let consoleEntry = new ConsoleLogEntry(

)
if (filterBy != undefined) {
if (filterBy !== undefined) {
if (params?.level === filterBy.getLevel()) {

@@ -229,3 +232,3 @@ callback(consoleEntry)

if (
params != undefined &&
params !== undefined &&
!['console', 'javascript'].includes(params?.type)

@@ -241,3 +244,3 @@ ) {

if (filterBy != undefined) {
if (filterBy !== undefined) {
if (params?.level === filterBy.getLevel()) {

@@ -244,0 +247,0 @@ callback(genericEntry)

@@ -126,3 +126,3 @@ // Licensed to the Software Freedom Conservancy (SFC) under one

if ('type' in remoteValue) {
var typeString = remoteValue['type']
const typeString = remoteValue['type']
if (PrimitiveType.findByName(typeString) != null) {

@@ -129,0 +129,0 @@ this.type = PrimitiveType.findByName(typeString)

@@ -185,3 +185,3 @@ // Licensed to the Software Freedom Conservancy (SFC) under one

functionDeclaration,
argumentValueList = null,
argumentValueList = [],
sandbox = null

@@ -289,8 +289,8 @@ ) {

createEvaluateResult(response) {
var type = response.result.type
var realmId = response.result.realm
var evaluateResult
const type = response.result.type
const realmId = response.result.realm
let evaluateResult
if (type === EvaluateResultType.SUCCESS) {
var result = response.result.result
const result = response.result.result
evaluateResult = new EvaluateResultSuccess(

@@ -301,3 +301,3 @@ realmId,

} else {
var exceptionDetails = response.result.exceptionDetails
const exceptionDetails = response.result.exceptionDetails
evaluateResult = new EvaluateResultException(

@@ -312,3 +312,3 @@ realmId,

realmInfoMapper(realms) {
var realmsList = []
const realmsList = []
realms.forEach((realm) => {

@@ -315,0 +315,0 @@ realmsList.push(RealmInfo.fromJson(realm))

@@ -0,1 +1,27 @@

## v4.11.0
#### :nail_care: Polish
* [BiDi] fix addPreloadScript failing tests (#12182)
* Print debug message once for each browser when selenium manager used
* Add forgotten RelativeBy in check options (#12289)
* SM supports all browsers in Selenium since a while ago
* Using SM to check drivers on the PATH
* Display info about SM activity
* Removing logic to find drivers, delegating to Selenium Manager
* Removing service parameter from getPath
* add support for Chrome 115 and remove support for Chrome 112
* Update webdriver-bootstrap.js (#12276)
#### :rocket: New Feature
* [BiDi] add Network module events (#12197)
* Adding ignore process match for IE Mode across bindings (#12279)
* Add browser output from Selenium Manager to options (#12411)
#### :bug: Bug Fix
* fix SeleniumServer.start() crashes on MacOS with nodejs selenium-webdriver (#12158)
* Update by.js: Add forgotten RelativeBy in check options (#12289)
## v4.10.0

@@ -1310,1 +1336,10 @@

npm install selenium-webdriver

@@ -133,11 +133,4 @@ // Licensed to the Software Freedom Conservancy (SFC) under one

const chromium = require('./chromium')
const CHROME_CAPABILITY_KEY = 'goog:chromeOptions'
/**
* Name of the ChromeDriver executable.
* @type {string}
* @const
*/
const CHROMEDRIVER_EXE =
process.platform === 'win32' ? 'chromedriver.exe' : 'chromedriver'
/** @type {remote.DriverService} */

@@ -160,4 +153,3 @@

constructor(opt_exe) {
let exe = opt_exe || locateSynchronously()
super(exe)
super(opt_exe)
}

@@ -234,3 +226,3 @@ }

return /** @type {!Driver} */ (
super.createSession(caps, opt_serviceExecutor)
super.createSession(caps, opt_serviceExecutor, 'goog', CHROME_CAPABILITY_KEY)
)

@@ -248,22 +240,10 @@ }

/**
* _Synchronously_ attempts to locate the chromedriver executable on the current
* system.
*
* @return {?string} the located executable, or `null`.
*/
function locateSynchronously() {
return io.findInPath(CHROMEDRIVER_EXE, true)
}
Options.prototype.CAPABILITY_KEY = 'goog:chromeOptions'
Options.prototype.CAPABILITY_KEY = CHROME_CAPABILITY_KEY
Options.prototype.BROWSER_NAME_VALUE = Browser.CHROME
Driver.prototype.VENDOR_COMMAND_PREFIX = 'goog'
// PUBLIC API
module.exports = {
Driver: Driver,
Driver,
Options,
ServiceBuilder,
locateSynchronously,
}

@@ -672,3 +672,3 @@ // Licensed to the Software Freedom Conservancy (SFC) under one

*
* @param {(Capabilities|Options)=} opt_config The configuration options.
* @param {(Capabilities|Options)=} caps The configuration options.
* @param {(remote.DriverService|http.Executor)=} opt_serviceExecutor Either

@@ -679,5 +679,8 @@ * a DriverService to use for the remote end, or a preconfigured executor

* default.
* @param vendorPrefix Either 'goog' or 'ms'
* @param vendorCapabilityKey Either 'goog:chromeOptions' or 'ms:edgeOptions'
* @return {!Driver} A new driver instance.
*/
static createSession(caps, opt_serviceExecutor) {
static createSession(caps, opt_serviceExecutor,
vendorPrefix = '', vendorCapabilityKey = '') {
let executor

@@ -687,10 +690,18 @@ let onQuit

executor = opt_serviceExecutor
configureExecutor(executor, this.VENDOR_COMMAND_PREFIX)
configureExecutor(executor, vendorPrefix)
} else {
let service = opt_serviceExecutor || this.getDefaultService()
if (!service.getExecutable()) {
service.setExecutable(getPath(service, caps))
const {driverPath, browserPath} = getPath(caps)
service.setExecutable(driverPath)
const vendorOptions = caps.get(vendorCapabilityKey)
if (vendorOptions) {
vendorOptions['binary'] = browserPath
caps.set(vendorCapabilityKey, vendorOptions)
} else {
caps.set(vendorCapabilityKey, {binary: browserPath})
}
}
onQuit = () => service.kill()
executor = createExecutor(service.start(), this.VENDOR_COMMAND_PREFIX)
executor = createExecutor(service.start(), vendorPrefix)
}

@@ -697,0 +708,0 @@

@@ -25,11 +25,11 @@ // Licensed to the Software Freedom Conservancy (SFC) under one

const { driverLocation } = require('./seleniumManager')
const fs = require('fs')
/**
* Determines the path of the correct Selenium Manager binary
* @returns {string}
* @returns {{browserPath: string, driverPath: string}} path of the driver
* and browser location
*/
function getPath(service, capabilities) {
function getPath(capabilities) {
try {
return pathExists(service.getExecutable()) || driverLocation(capabilities)
return driverLocation(capabilities)
} catch (e) {

@@ -39,3 +39,3 @@ throw Error(

For more information on how to install drivers see
https://www.selenium.dev/documentation/webdriver/getting_started/install_drivers/. ${e}`
https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/driver_location/. ${e}`
)

@@ -45,18 +45,3 @@ }

/**
* _Synchronously_ attempts to locate the driver executable on the current
* system.
*
* @param {!string} driverPath
*
* @return {?string} the located executable, or `null`.
*/
function pathExists(driverPath) {
if (!driverPath || !fs.existsSync(driverPath)) {
return null
}
return driverPath
}
// PUBLIC API
module.exports = { getPath }

@@ -29,7 +29,3 @@ // Licensed to the Software Freedom Conservancy (SFC) under one

/**
* currently supported browsers for selenium-manager
* @type {string[]}
*/
const Browser = ['chrome', 'firefox', 'edge', 'MicrosoftEdge', 'iexplorer']
let debugMessagePrinted = false;

@@ -59,2 +55,7 @@ /**

if (!debugMessagePrinted) {
console.debug(`Selenium Manager binary found at ${filePath}`)
debugMessagePrinted = true; // Set the flag to true after printing the debug message
}
return filePath

@@ -66,16 +67,7 @@ }

* @param {Capabilities} options browser options to fetch the driver
* @returns {string} path of the driver location
* @returns {{browserPath: string, driverPath: string}} path of the driver and
* browser location
*/
function driverLocation(options) {
if (!Browser.includes(options.getBrowserName().toLocaleString())) {
throw new Error(
`Unable to locate driver associated with browser name: ${options.getBrowserName()}`
)
}
console.debug(
'Applicable driver not found; attempting to install with Selenium Manager (Beta)'
)
let args = ['--browser', options.getBrowserName(), '--output', 'json']

@@ -122,2 +114,3 @@

output = JSON.parse(spawnResult.stdout.toString())
logOutput(output)
errorMessage = output.result.message

@@ -140,2 +133,10 @@ } catch (e) {

logOutput(output)
return {
driverPath: output.result.driver_path,
browserPath: output.result.browser_path,
}
}
function logOutput (output) {
for (const key in output.logs) {

@@ -145,5 +146,6 @@ if (output.logs[key].level === 'WARN') {

}
if (['DEBUG', 'INFO'].includes(output.logs[key].level)) {
console.debug(`${output.logs[key].message}`)
}
}
return output.result.message
}

@@ -150,0 +152,0 @@

@@ -81,13 +81,5 @@ // Licensed to the Software Freedom Conservancy (SFC) under one

const { Browser } = require('./lib/capabilities')
const io = require('./io')
const chromium = require('./chromium')
const EDGE_CAPABILITY_KEY = 'ms:edgeOptions'
/**
* Name of the EdgeDriver executable.
* @type {string}
* @const
*/
const EDGEDRIVER_CHROMIUM_EXE =
process.platform === 'win32' ? 'msedgedriver.exe' : 'msedgedriver'
/** @type {remote.DriverService} */

@@ -109,4 +101,3 @@

constructor(opt_exe) {
let exe = opt_exe || locateSynchronously()
super(exe)
super(opt_exe)
this.setLoopback(true)

@@ -162,3 +153,3 @@ }

return /** @type {!Driver} */ (
super.createSession(caps, opt_serviceExecutor)
super.createSession(caps, opt_serviceExecutor, 'ms', EDGE_CAPABILITY_KEY)
)

@@ -183,15 +174,4 @@ }

/**
* _Synchronously_ attempts to locate the chromedriver executable on the current
* system.
*
* @return {?string} the located executable, or `null`.
*/
function locateSynchronously() {
return io.findInPath(EDGEDRIVER_CHROMIUM_EXE, true)
}
Options.prototype.BROWSER_NAME_VALUE = Browser.EDGE
Options.prototype.CAPABILITY_KEY = 'ms:edgeOptions'
Driver.prototype.VENDOR_CAPABILITY_PREFIX = 'ms'
Options.prototype.CAPABILITY_KEY = EDGE_CAPABILITY_KEY

@@ -204,3 +184,2 @@ // PUBLIC API

ServiceBuilder,
locateSynchronously,
}

@@ -131,2 +131,3 @@ // Licensed to the Software Freedom Conservancy (SFC) under one

const { getPath } = require('./common/driverFinder')
const FIREFOX_CAPABILITY_KEY = 'moz:firefoxOptions'

@@ -267,6 +268,6 @@ /**

firefoxOptions_() {
let options = this.get('moz:firefoxOptions')
let options = this.get(FIREFOX_CAPABILITY_KEY)
if (!options) {
options = {}
this.set('moz:firefoxOptions', options)
this.set(FIREFOX_CAPABILITY_KEY, options)
}

@@ -458,24 +459,3 @@ return options

const GECKO_DRIVER_EXE =
process.platform === 'win32' ? 'geckodriver.exe' : 'geckodriver'
/**
* _Synchronously_ attempts to locate the geckodriver executable on the current
* system.
*
* @return {?string} the located executable, or `null`.
*/
function locateSynchronously() {
return io.findInPath(GECKO_DRIVER_EXE, true)
}
/**
* @return {string} .
* @throws {Error}
*/
function findGeckoDriver() {
return locateSynchronously()
}
/**
* @param {string} file Path to the file to find, relative to the program files

@@ -561,3 +541,3 @@ * root.

constructor(opt_exe) {
super(opt_exe || findGeckoDriver())
super(opt_exe)
this.setLoopback(true) // Required.

@@ -608,2 +588,4 @@ }

let firefoxBrowserPath = null
let executor

@@ -617,3 +599,5 @@ let onQuit

if (!opt_executor.getExecutable()) {
opt_executor.setExecutable(getPath(opt_executor, opt_config))
const {driverPath, browserPath} = getPath(caps)
opt_executor.setExecutable(driverPath)
firefoxBrowserPath = browserPath
}

@@ -625,3 +609,5 @@ executor = createExecutor(opt_executor.start())

if (!service.getExecutable()) {
service.setExecutable(getPath(service, opt_config))
const {driverPath, browserPath} = getPath(caps)
service.setExecutable(driverPath)
firefoxBrowserPath = browserPath
}

@@ -632,2 +618,12 @@ executor = createExecutor(service.start())

if (firefoxBrowserPath) {
const vendorOptions = caps.get(FIREFOX_CAPABILITY_KEY)
if (vendorOptions) {
vendorOptions['binary'] = firefoxBrowserPath
caps.set(FIREFOX_CAPABILITY_KEY, vendorOptions)
} else {
caps.set(FIREFOX_CAPABILITY_KEY, {binary: firefoxBrowserPath})
}
}
return /** @type {!Driver} */ (super.createSession(executor, caps, onQuit))

@@ -843,3 +839,2 @@ }

ServiceBuilder,
locateSynchronously,
}

@@ -30,5 +30,3 @@ // Licensed to the Software Freedom Conservancy (SFC) under one

const fs = require('fs')
const http = require('./http')
const io = require('./io')
const portprober = require('./net/portprober')

@@ -41,3 +39,2 @@ const remote = require('./remote')

const IEDRIVER_EXE = 'IEDriverServer.exe'
const OPTIONS_CAPABILITY_KEY = 'se:ieOptions'

@@ -88,2 +85,3 @@ const SCROLL_BEHAVIOUR = {

EDGE_EXECUTABLE_PATH: 'ie.edgepath',
IGNORE_PROCESS_MATCH: 'ie.ignoreprocessmatch',
}

@@ -385,12 +383,2 @@

/**
* _Synchronously_ attempts to locate the IE driver executable on the current
* system.
*
* @return {?string} the located executable, or `null`.
*/
function locateSynchronously() {
return process.platform === 'win32' ? io.findInPath(IEDRIVER_EXE, true) : null
}
function createServiceFromCapabilities(capabilities) {

@@ -406,3 +394,3 @@ if (process.platform !== 'win32') {

let exe = locateSynchronously()
let exe = null // Let Selenium Manager find it
var args = []

@@ -447,3 +435,3 @@ if (capabilities.has(Key.HOST)) {

constructor(opt_exe) {
super(opt_exe || IEDRIVER_EXE)
super(opt_exe)
this.setLoopback(true) // Required.

@@ -476,3 +464,3 @@ }

if (!service.getExecutable()) {
service.setExecutable(getPath(service, options))
service.setExecutable(getPath(options).driverPath)
}

@@ -505,2 +493,1 @@

exports.Behavior = SCROLL_BEHAVIOUR
exports.locateSynchronously = locateSynchronously

@@ -46,2 +46,3 @@ // Licensed to the Software Freedom Conservancy (SFC) under one

const ScriptManager = require('./bidi/scriptManager')
const NetworkInspector = require('./bidi/networkInspector')

@@ -807,1 +808,2 @@ const Browser = capabilities.Browser

exports.ScriptManager = ScriptManager
exports.NetworkInspector = NetworkInspector

@@ -399,3 +399,3 @@ // Licensed to the Software Freedom Conservancy (SFC) under one

function check(locator) {
if (locator instanceof By || typeof locator === 'function') {
if (locator instanceof By || locator instanceof RelativeBy || typeof locator === 'function') {
return locator

@@ -402,0 +402,0 @@ }

{
"name": "selenium-webdriver",
"version": "4.10.0",
"version": "4.11.0",
"description": "The official WebDriver JavaScript bindings from the Selenium project",

@@ -31,13 +31,13 @@ "license": "Apache-2.0",

"devDependencies": {
"eslint": "^8.41.0",
"eslint": "^8.44.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-no-only-tests": "^3.1.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-prettier": "^5.0.0",
"express": "^4.18.2",
"mocha": "^10.2.0",
"multer": "^1.4.5-lts.1",
"prettier": "^2.8.8",
"prettier": "^3.0.0",
"serve-index": "^1.9.1",
"sinon": "^15.1.0"
"sinon": "^15.2.0"
},

@@ -44,0 +44,0 @@ "scripts": {

@@ -40,5 +40,3 @@ // Licensed to the Software Freedom Conservancy (SFC) under one

const execRes = cp.execSync(
`${javaPath} -jar ${seleniumStandalonePath} --version`
)
const execRes = cp.execFileSync(javaPath, ['-jar', seleniumStandalonePath, '--version'])

@@ -45,0 +43,0 @@ return execRes.toString().trim().startsWith('Selenium server version: 3')

@@ -25,35 +25,8 @@ // Licensed to the Software Freedom Conservancy (SFC) under one

const http = require('./http')
const io = require('./io')
const remote = require('./remote')
const webdriver = require('./lib/webdriver')
const { Browser, Capabilities } = require('./lib/capabilities')
const { getPath } = require('./common/driverFinder')
/**
* _Synchronously_ attempts to locate the IE driver executable on the current
* system.
*
* @return {?string} the located executable, or `null`.
*/
function locateSynchronously() {
return process.platform === 'darwin'
? io.findInPath('safaridriver', true)
: null
}
/**
* @return {string} .
* @throws {Error}
*/
function findSafariDriver() {
let exe = locateSynchronously()
if (!exe) {
throw Error(
`The safaridriver executable could not be found on the current PATH.
Please ensure you are using Safari 10.0 or above.`
)
}
return exe
}
/**
* Creates {@link selenium-webdriver/remote.DriverService} instances that manage

@@ -70,3 +43,3 @@ * a [safaridriver] server in a child process.

constructor(opt_exe) {
super(opt_exe || findSafariDriver())
super(opt_exe)
this.setLoopback(true) // Required.

@@ -76,3 +49,3 @@ }

const OPTIONS_CAPABILITY_KEY = 'safari.options'
const OPTIONS_CAPABILITY_KEY = 'safari:options'
const TECHNOLOGY_PREVIEW_OPTIONS_KEY = 'technologyPreview'

@@ -156,2 +129,5 @@

let service = new ServiceBuilder(exe).build()
if (!service.getExecutable()) {
service.setExecutable(getPath(caps).driverPath)
}
let executor = new http.Executor(

@@ -172,2 +148,1 @@ service.start().then((url) => new http.HttpClient(url))

exports.ServiceBuilder = ServiceBuilder
exports.locateSynchronously = locateSynchronously

@@ -44,2 +44,3 @@ // Licensed to the Software Freedom Conservancy (SFC) under one

const { Builder } = require('../index')
const { getPath } = require('../common/driverFinder')

@@ -121,7 +122,7 @@ /**

let targets = [
[chrome.locateSynchronously, Browser.CHROME],
[edge.locateSynchronously, Browser.EDGE],
[firefox.locateSynchronously, Browser.FIREFOX],
[ie.locateSynchronously, Browser.INTERNET_EXPLORER],
[safari.locateSynchronously, Browser.SAFARI],
[getPath(chrome.Options).driverPath, Browser.CHROME],
[getPath(edge.Options).driverPath, Browser.EDGE],
[getPath(firefox.Options).driverPath, Browser.FIREFOX],
[getPath(ie.Options).driverPath, Browser.INTERNET_EXPLORER],
[getPath(safari.Options).driverPath, Browser.SAFARI],
]

@@ -131,6 +132,6 @@

for (let pair of targets) {
const fn = pair[0]
const driverPath = pair[0]
const name = pair[1]
const capabilities = pair[2]
if (fn()) {
if (driverPath.length > 0) {
info(`... located ${name}`)

@@ -137,0 +138,0 @@ availableBrowsers.push({ name, capabilities })

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

Sorry, the diff of this file is too big to display

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