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.
'strategy': 'css selector', 'strategyVal': '[id*="unique-ID"]'
'strategy': 'css selector', 'strategyVal': '[id*=unique-ID]'
'strategy': 'xpath', 'strategyVal': '//*[contains(@id, "unique-ID")]'
'strategy': 'xpath', 'strategyVal': '//*[@id*="unique-ID"]'
'strategy': 'xpath', 'strategyVal': '//*[contains(@id, "unique-ID")]'
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.
'strategy': 'xpath', 'strategyVal': '//android.view.ViewGroup[contains(@resource-id, "unique-ID")]'