New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

devtools

Package Overview
Dependencies
Maintainers
7
Versions
388
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

devtools - npm Package Compare versions

Comparing version 5.22.4 to 5.23.0

24

build/commands/switchToFrame.js

@@ -17,2 +17,13 @@ "use strict";

if (id === null && typeof page.parentFrame === 'function') {
let parentFrame = await page.parentFrame();
while (parentFrame) {
parentFrame = await parentFrame.parentFrame();
}
this.currentFrame = parentFrame;
return null;
}
if (typeof id[_constants.ELEMENT_KEY] === 'string') {

@@ -37,3 +48,3 @@ const elementHandle = this.elementStore.get(id[_constants.ELEMENT_KEY]);

let getFrames = page.frames || page.childFrames;
const childFrames = await getFrames();
const childFrames = await getFrames.apply(page);
const childFrame = childFrames[id];

@@ -49,14 +60,3 @@

if (id === null && typeof page.parentFrame === 'function') {
let parentFrame = await page.parentFrame();
while (parentFrame) {
parentFrame = await page.parentFrame();
}
this.currentFrame = parentFrame;
return null;
}
throw new Error(`Could not switch frame, unknwon id: ${id}`);
}

@@ -6,3 +6,3 @@ "use strict";

});
exports.ERROR_MESSAGES = exports.SERIALIZE_FLAG = exports.SERIALIZE_PROPERTY = exports.SUPPORTED_SELECTOR_STRATEGIES = exports.DEFAULT_SCRIPT_TIMEOUT = exports.DEFAULT_PAGELOAD_TIMEOUT = exports.DEFAULT_IMPLICIT_TIMEOUT = exports.DEFAULTS = exports.EDGE_NAMES = exports.FIREFOX_NAMES = exports.CHROME_NAMES = exports.DEFAULT_FLAGS = exports.ELEMENT_KEY = exports.DEFAULT_Y_POSITION = exports.DEFAULT_X_POSITION = exports.DEFAULT_HEIGHT = exports.DEFAULT_WIDTH = void 0;
exports.VENDOR_PREFIX = exports.ERROR_MESSAGES = exports.SERIALIZE_FLAG = exports.SERIALIZE_PROPERTY = exports.SUPPORTED_SELECTOR_STRATEGIES = exports.DEFAULT_SCRIPT_TIMEOUT = exports.DEFAULT_PAGELOAD_TIMEOUT = exports.DEFAULT_IMPLICIT_TIMEOUT = exports.DEFAULTS = exports.EDGE_NAMES = exports.FIREFOX_NAMES = exports.CHROME_NAMES = exports.DEFAULT_FLAGS = exports.ELEMENT_KEY = exports.DEFAULT_Y_POSITION = exports.DEFAULT_X_POSITION = exports.DEFAULT_HEIGHT = exports.DEFAULT_WIDTH = void 0;
const DEFAULT_WIDTH = 1200;

@@ -64,2 +64,8 @@ exports.DEFAULT_WIDTH = DEFAULT_WIDTH;

};
exports.ERROR_MESSAGES = ERROR_MESSAGES;
exports.ERROR_MESSAGES = ERROR_MESSAGES;
const VENDOR_PREFIX = {
chrome: 'goog:chromeOptions',
firefox: 'moz:firefoxOptions',
edge: 'ms:edgeOptions'
};
exports.VENDOR_PREFIX = VENDOR_PREFIX;

@@ -50,2 +50,3 @@ "use strict";

const [browserName, browserVersion] = (await browser.version()).split('/');
params.requestedCapabilities = _objectSpread({}, params.capabilities);
params.capabilities = {

@@ -60,6 +61,2 @@ browserName,

};
params.requestedCapabilities = {
w3cCaps: params.capabilities,
jsonwpCaps: params.capabilities
};
sessionMap.set(sessionId, {

@@ -86,3 +83,3 @@ browser,

const prototype = _objectSpread({}, protocolCommands, {}, environmentPrototype, {}, userPrototype);
const prototype = _objectSpread(_objectSpread(_objectSpread({}, protocolCommands), environmentPrototype), userPrototype);

@@ -97,6 +94,3 @@ const monad = (0, _utils.webdriverMonad)(params, modifier, prototype);

} = sessionMap.get(instance.sessionId);
const {
w3cCaps
} = instance.options.requestedCapabilities;
const browser = await (0, _launcher.default)(w3cCaps);
const browser = await (0, _launcher.default)(instance.requestedCapabilities);
const pages = await browser.pages();

@@ -103,0 +97,0 @@ session.elementStore.clear();

@@ -12,2 +12,4 @@ "use strict";

var _DeviceDescriptors = _interopRequireDefault(require("puppeteer-core/DeviceDescriptors"));
var _logger = _interopRequireDefault(require("@wdio/logger"));

@@ -22,7 +24,35 @@

const log = (0, _logger.default)('devtools');
const DEVICE_NAMES = Object.values(_DeviceDescriptors.default).map(device => device.name);
async function launchChrome(capabilities) {
const chromeOptions = capabilities['goog:chromeOptions'] || {};
const chromeOptions = capabilities[_constants.VENDOR_PREFIX.chrome] || {};
const mobileEmulation = chromeOptions.mobileEmulation || {};
if (typeof mobileEmulation.deviceName === 'string') {
const deviceProperties = Object.values(_DeviceDescriptors.default).find(device => device.name === mobileEmulation.deviceName);
if (!deviceProperties) {
throw new Error(`Unknown device name "${mobileEmulation.deviceName}", available: ${DEVICE_NAMES.join(', ')}`);
}
mobileEmulation.userAgent = deviceProperties.userAgent;
mobileEmulation.deviceMetrics = {
width: deviceProperties.viewport.width,
height: deviceProperties.viewport.height,
pixelRatio: deviceProperties.viewport.deviceScaleFactor
};
}
const deviceMetrics = mobileEmulation.deviceMetrics || {};
const chromeFlags = [..._constants.DEFAULT_FLAGS, ...[`--window-position=${_constants.DEFAULT_X_POSITION},${_constants.DEFAULT_Y_POSITION}`, `--window-size=${_constants.DEFAULT_WIDTH},${_constants.DEFAULT_HEIGHT}`], ...(chromeOptions.headless ? ['--headless', '--no-sandbox'] : []), ...(chromeOptions.args || [])];
log.info(`Launch Chrome with flags: ${chromeFlags.join(' ')}`);
if (typeof deviceMetrics.pixelRatio === 'number') {
chromeFlags.push(`--device-scale-factor=${deviceMetrics.pixelRatio}`);
}
if (typeof mobileEmulation.userAgent === 'string') {
chromeFlags.push(`--user-agent=${mobileEmulation.userAgent}`);
}
log.info(`Launch Google Chrome with flags: ${chromeFlags.join(' ')}`);
const chrome = await (0, _chromeLauncher.launch)({

@@ -45,2 +75,6 @@ chromePath: chromeOptions.binary,

if (deviceMetrics.width && deviceMetrics.height) {
await pages[0].setViewport(deviceMetrics);
}
return browser;

@@ -47,0 +81,0 @@ }

@@ -5,3 +5,3 @@ /// <reference types="node"/>

declare namespace WebDriver {
interface ClientOptions {
interface ClientOptions extends WebDriver.BaseClient {
isDevTools: boolean;

@@ -8,0 +8,0 @@ getPuppeteer: (...args: any[]) => any;

{
"name": "devtools",
"version": "5.22.4",
"version": "5.23.0",
"description": "A Chrome DevTools protocol binding that maps WebDriver commands into Chrome DevTools commands using Puppeteer",

@@ -36,5 +36,7 @@ "author": "Christian Bromann <christian@saucelabs.com>",

"@wdio/protocols": "5.22.1",
"@wdio/utils": "5.18.6",
"@wdio/utils": "5.23.0",
"chrome-launcher": "^0.11.1",
"puppeteer-core": "^1.18.1"
"puppeteer-core": "^1.18.1",
"ua-parser-js": "^0.7.21",
"uuid": "^7.0.2"
},

@@ -47,3 +49,3 @@ "devDependencies": {

},
"gitHead": "1a093237fe927a5db470f8a839b342df02913804"
"gitHead": "a9b8098ad18074e05a72c0458a7845a41a40aa93"
}
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