Can't group selectors with $ and $$ as described in the Webdriver-IO docs

I am using Spectron WebdriverIO which is in 4.7.1 version in node_modules. I am trying to getText from an element, but selecting it gradually creates problems.

I can "Copy -> selector" in dev tools to give me a very specific path. This works if i .element(longPath)

.

Chaining with $

and $$

(or element

/ elements

) doesn't work for me :

const name = await client
  .$($sideNav)
  .$$($storageItem)[0]
  .$('.StorageItem__header-info___browser-main-SideNav- span')
  .getText()

      

Access [0]

gives me undefined

. If I go out of the allowed value $$($storageItem)

, I get:

[ { ELEMENT: '0.16994195059314898-2',
    value: { ELEMENT: '0.16994195059314898-2' },
    selector: '.StorageItem__root___browser-main-SideNav-',
    index: 0 } ]

      

Any ideas why I can't connect as shown in the example here: http://webdriver.io/v4.7/api/utility/$.html

Many thanks.

+3


source to share





All Articles