File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff 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' );
You can’t perform that action at this time.
0 commit comments