Currently, I am upgrading the WebDriverIo version from 4 to 5 wherein one of the existing tests we are applying waitForExist on two selectors simultaneously. In v4 it's like this .waitForExist(selector loadingSelector, null, true)
But in V5 waitForExist chaining to selector and therefore I've refactored this to await (sel1 loadingSelector).waitForExist(0,true,null);
but this throwing error `TypeError: (selector loadingSelector).waitForExist is not a function
Here is my bit of command code:
addIdeCommand('ideOpenFolder', async function (folder, treeCls, fuzzy) {
var sel1 =await browser.$(sel1);
var loadSelector = await browser.$(sel2);
await sel1.waitForDisplayed();
// Wait for the loading icon to disappear (true = not exists)
**await (selector loadSelector).waitForExist(0,true,null);**
await this.waitUntil(async function () {
//something
});
});
Can someone please help me with how to apply waitForExisting() on multiple selectors at the same time?
CodePudding user response:
You could use Promise.all:
await Promise.all([
method1,
method2,
...
])