MCPcopy Index your code
hub / github.com/codeceptjs/CodeceptJS / _isDisplayedSafe

Method _isDisplayedSafe

lib/helper/Appium.js:420–436  ·  view source on GitHub ↗

* Helper method to safely call isDisplayed() on mobile elements. * Handles the case where webdriverio tries to use execute/sync which isn't supported in Appium. * @private

(element)

Source from the content-addressed store, hash-verified

418 * @private
419 */
420 async _isDisplayedSafe(element) {
421 if (this.isWeb) {
422 // For web contexts, use the normal isDisplayed
423 return element.isDisplayed()
424 }
425
426 try {
427 return await element.isDisplayed()
428 } catch (err) {
429 // If isDisplayed fails due to execute/sync not being supported in native mobile contexts,
430 // fall back to assuming the element is displayed (since we found it)
431 if (err.message && err.message.includes('Method is not implemented')) {
432 return true
433 }
434 throw err
435 }
436 }
437
438 /**
439 * Execute code only on iOS

Callers 6

swipeToMethod · 0.95
dontSeeElementMethod · 0.95
seeElementMethod · 0.95
waitForVisibleMethod · 0.95
waitForInvisibleMethod · 0.95

Calls 1

includesMethod · 0.80

Tested by

no test coverage detected