async function t(e){
return e;
}
async getByResourceId(id, wait= 5000){
const elm = this.driver.$('android=new UiSelector().resourceId("'+id+'")');
const telm = await t(elm);
}
I am trying to automate a android app with appium and webdriverio and I am having a very odd bug. I use the $ function (it happens with the element function as well) of webdriver to locate an element which I then pass to the function t. When I get it back it is a different obj.
I tried to add a delay between the first and second line in getByResourceId to make sure that it wasn't a timing bug:
async getByResourceId(id, wait= 5000){
const elm = this.driver.$('android=new UiSelector().resourceId("'+id+'")');
await _setTimeout(5000);
//elm still OK (aka elm.click works)
const telm = await t(elm);
//telm is broken (aka getting TypeError: telm.click is not a function)
}
That didn't work. The thing that breaks elm is t returning a promise. Does anyone have any ideas how to get this to work?
edit: I found this https://stackoverflow.com/a/47176108/10816010 to be very helpful. apparently I had to use the synchronous approach (using the WDIO test-runner) and let the WDIO test-runner control the synchronizing instead of using async await in order to get the functionality I wanted.
edit 2: this is not relevant in version 5 of webdriverio