isDisplayed
Return true if the selected DOM-element is displayed (even when the element is outside the viewport).
If you want to verify that the element is also within the viewport, provide the withinViewport
flag to the command.
As opposed to other element commands WebdriverIO will not wait for the element to exist to execute this command.
WebdriverIO, when conducting browser tests, utilizes a custom script
specifically designed to assess the visibility of elements. This script is key in determining whether an
element is displayed on the page. Conversely, for native mobile testing scenarios with Appium, WebdriverIO
defers to the isElementDisplayed
command provided by Appium. This command evaluates the visibility of elements using criteria established by the
underlying Appium driver, ensuring accurate and driver-specific assessments for mobile applications.
Usage
$(selector).isDisplayed([isWithinViewport=false])