File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed
Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -19,21 +19,20 @@ export const getSelector = (el: WebdriverIO.Element | WebdriverIO.ElementArray)
1919
2020export const getSelectors = ( el : WebdriverIO . Element | WdioElements ) : string => {
2121
22- const selectors = [ ]
23- if ( Array . isArray ( el ) ) {
24- for ( const element of el ) {
25- selectors . push ( getSelectors ( element ) )
26- }
27- return selectors . join ( ', ' )
28- }
29-
3022 let parent : WebdriverIO . ElementArray [ 'parent' ] | undefined
3123
24+ const selectors : string [ ] = [ ]
3225 if ( isElementArray ( el ) ) {
3326 selectors . push ( `${ ( el ) . foundWith } (\`${ getSelector ( el ) } \`)` )
3427 parent = el . parent
3528 } else if ( ! Array . isArray ( el ) ) {
3629 parent = el
30+ } else if ( Array . isArray ( el ) ) {
31+ for ( const element of el ) {
32+ selectors . push ( getSelectors ( element ) )
33+ }
34+ // When not having more context about the common parent, return joined selectors
35+ return selectors . join ( ', ' )
3736 }
3837
3938 while ( parent && 'selector' in parent ) {
You can’t perform that action at this time.
0 commit comments