I have a Android Native UI where I have:
- Find By: id, Selector: 76ggg-unique-ID-o9o
- Attribute – class: android.view.ViewGroup
- resource-id: 76ggg-unique-ID-o9o
Now I want to create a selector for this element in WebdriverIO where I can use contains unique-ID. I tried following but nothing worked.
JavaScript
x
3
1
'strategy': 'css selector',
2
'strategyVal': '[id*="unique-ID"]'
3
JavaScript
1
3
1
'strategy': 'css selector',
2
'strategyVal': '[id*=unique-ID]'
3
JavaScript
1
3
1
'strategy': 'xpath',
2
'strategyVal': '//*[contains(@id, "unique-ID")]'
3
JavaScript
1
3
1
'strategy': 'xpath',
2
'strategyVal': '//*[@id*="unique-ID"]'
3
JavaScript
1
3
1
'strategy': 'xpath',
2
'strategyVal': '//*[contains(@id, "unique-ID")]'
3
Any suggestion is appreciated.
Advertisement
Answer
After doing some debugging I came to know it was taking some time to load UI. After waiting for few seconds, below locator strategy worked.
JavaScript
1
3
1
'strategy': 'xpath',
2
'strategyVal': '//android.view.ViewGroup[contains(@resource-id, "unique-ID")]'
3