Skip to content

Commit bd172b7

Browse files
author
George Griffiths
committed
update readme
1 parent 2c0cdb8 commit bd172b7

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

README.md

+9-2
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,22 @@ const { locatorStrategy } = require('query-selector-shadow-dom/plugins/webdriver
3737
}
3838
})
3939

40+
// The magic - registry custom strategy
41+
browser.addLocatorStrategy('shadow', locatorStrategy);
42+
43+
44+
// now you have a `shadow` custom locator.
45+
4046
// All elements on the page
4147
await browser.waitUntil(() => browser.custom$("shadow", ".btn-in-shadow-dom"));
4248
const elements = await browser.$$("*");
49+
4350
const elementsShadow = await browser.custom$$("shadow", "*");
51+
4452
console.log("All Elements on Page Excluding Shadow Dom", elements.length);
4553
console.log("All Elements on Page Including Shadow Dom", elementsShadow.length);
4654

47-
// registry custom strategy
48-
browser.addLocatorStrategy('shadow', locatorStrategy);
55+
4956
await browser.url('http://127.0.0.1:5500/test/')
5057
// find input element in shadow dom
5158
const input = await browser.custom$('shadow', '#type-to-input');

0 commit comments

Comments
 (0)