Skip to content

Commit e4478df

Browse files
author
George Griffiths
committed
code review changes
1 parent e0c8adc commit e4478df

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,28 @@ Both of the methods above accept a 2nd parameter, see section `Provide alternati
1818

1919
## Examples
2020

21+
### Playwright
22+
23+
Playwright works really nicely with this package.
24+
25+
This module exposes a playwright `selectorEngine`: https://github.com/microsoft/playwright/blob/master/docs/api.md#selectorsregisterenginefunction-args
26+
27+
```javascript
28+
const { selectorEngine } = require("query-selector-shadow-dom/plugins/playwright");
29+
const playwright = require('playwright');
30+
...
31+
await playwright.selectors.register(selectorEngine, { name: 'shadow' })
32+
...
33+
await page.goto('chrome://downloads');
34+
// shadow= allows a css query selector that automatically pierces shadow roots.
35+
await page.waitForSelector('shadow=#no-downloads span', {timeout: 3000})
36+
```
37+
38+
For a full example see: https://github.com/Georgegriff/query-selector-shadow-dom/blob/master/examples/playwright
39+
2140
### Puppeteer
2241

23-
There are some puppeteer examples available in the exampes folder of this repository.
42+
There are some puppeteer examples available in the examples folder of this repository.
2443

2544
[Puppeteer examples](https://github.com/Georgegriff/query-selector-shadow-dom/blob/master/examples/puppeteer)
2645

plugins/playwright/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const querySelectorShadowDomUMD = fs.readFileSync(path.resolve(__dirname, "../..
99
// make sure that query-selector-shadow-dom is injected and loaded into the function closure
1010
const engineString =`
1111
options = options || {};
12-
const name = options.name;
12+
const name = options.name || 'shadow';
1313
${querySelectorShadowDomUMD}
1414
return {
1515
name: name,

0 commit comments

Comments
 (0)