Skip to content

Commit 2be94a8

Browse files
authored
fix: seeElement wdio
1 parent 0230fe9 commit 2be94a8

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

lib/helper/WebDriver.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1458,16 +1458,18 @@ class WebDriver extends Helper {
14581458
* {{ react }}
14591459
*
14601460
*/
1461-
async seeElement(locator) {
1462-
const res = await this._locate(locator, true)
1463-
assertElementExists(res, locator)
1464-
const selected = await forEachAsync(res, async el => el.isDisplayed())
1465-
try {
1466-
return truth(`elements of ${new Locator(locator)}`, 'to be seen').assert(selected)
1467-
} catch (e) {
1468-
dontSeeElementError(locator)
1469-
}
1461+
async seeElement(locator) {
1462+
const elements = await this._locate(locator, true);
1463+
assertElementExists(elements, locator);
1464+
1465+
const visibility = await Promise.all(elements.map(el => el.isDisplayed()));
1466+
1467+
try {
1468+
return truth(`elements of ${new Locator(locator)}`, 'to be seen').assert(visibility);
1469+
} catch (error) {
1470+
dontSeeElementError(locator);
14701471
}
1472+
}
14711473

14721474
/**
14731475
* {{> dontSeeElement }}

0 commit comments

Comments
 (0)