I'm using Spectron's WebdriverIO which is at version 4.7.1 in node_modules. I'm trying to getText from an element but selecting it gradually is giving me trouble.
I can "Copy -> selector" in dev tools to give me a very specific path. This works if I .element(longPath)
.
What isn't working for me is chaining with $
and $$
(or element
/ elements
):
const name = await client
.$($sideNav)
.$$($storageItem)[0]
.$('.StorageItem__header-info___browser-main-SideNav- span')
.getText()
Accessing [0]
gives me undefined
. If I log out the resolved value of $$($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 chain as shown in the example here: http://webdriver.io/v4.7/api/utility/$.html
Many thanks.