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.
wdio-shadowdom-service
Advanced tools
Plugin for webdriver.io to transparently make CSS selectors "just work" with shadow DOM
This is a plugin for WebDriverIO that transparently makes CSS selectors "just work" with the shadow DOM.
With this plugin, APIs like $('.foo')
and $$('.foo')
will automatically query inside the shadow DOM to find elements. This can help avoid
complicated or hard-to-maintain test code.
Before:
// 😞
const element = $('.foo')
.shadow$('.bar')
.shadow$('.baz')
.shadow$('.quux')
After:
// 🥳
const element = $('.quux')
Features:
$
, $$
, and even some basic usage of execute
all "just work" with the shadow DOM.document.querySelector
or document.querySelectorAll
. Only touches your test code, not your production code.npm install wdio-shadowdom-service
Modify your wdio.conf.js
like so:
const ShadowDomService = require('wdio-shadowdom-service')
exports.config = {
// ...
services: [ [ShadowDomService, {}] ],
// ...
}
webdriver
protocolDue to an open bug on WebDriverIO,
you will also need to use the webdriver
protocol, not the devtools
protocol. Set this in your wdio.conf.js
:
exports.config = {
// ...
automationProtocol: 'webdriver',
path: '/wd/hub',
// ...
}
Now you can use selector queries that pierce the shadow DOM:
const element = await browser.$('.foo')
const elements = await browser.$$('.foo')
Some simple usages of document.querySelector
/querySelectorAll
are also supported:
const element = await browser.execute(() => document.querySelector('.foo'))
const elements = await browser.execute(() => document.querySelectorAll('.foo'))
All selectors are able to pierce the shadow DOM, including selectors like '.outer .inner'
where .outer
is in the
light DOM and .inner
is in the shadow DOM. See kagekiri for more details
on how it works.
* execute
and executeAsync
only work with simple usages of document.querySelector
/querySelectorAll
or element.querySelector
/querySelectorAll
.
Currently, WebDriverIO v6 and v7 are supported.
To lint:
npm run lint
To fix most lint issues automatically:
npm run lint:fix
To run the tests:
npm test
To run the tests in debug mode:
DEBUG=true npm test
Then open chrome:inspector
in Chrome and open the dedicated DevTools for Node.
FAQs
Plugin for webdriver.io to transparently make CSS selectors "just work" with shadow DOM
The npm package wdio-shadowdom-service receives a total of 9 weekly downloads. As such, wdio-shadowdom-service popularity was classified as not popular.
We found that wdio-shadowdom-service demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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.