File tree 1 file changed +9
-2
lines changed
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
37
37
}
38
38
})
39
39
40
+ // The magic - registry custom strategy
41
+ browser .addLocatorStrategy (' shadow' , locatorStrategy);
42
+
43
+
44
+ // now you have a `shadow` custom locator.
45
+
40
46
// All elements on the page
41
47
await browser .waitUntil (() => browser .custom$ (" shadow" , " .btn-in-shadow-dom" ));
42
48
const elements = await browser .$$ (" *" );
49
+
43
50
const elementsShadow = await browser .custom$$ (" shadow" , " *" );
51
+
44
52
console .log (" All Elements on Page Excluding Shadow Dom" , elements .length );
45
53
console .log (" All Elements on Page Including Shadow Dom" , elementsShadow .length );
46
54
47
- // registry custom strategy
48
- browser .addLocatorStrategy (' shadow' , locatorStrategy);
55
+
49
56
await browser .url (' http://127.0.0.1:5500/test/' )
50
57
// find input element in shadow dom
51
58
const input = await browser .custom$ (' shadow' , ' #type-to-input' );
You can’t perform that action at this time.
0 commit comments