File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -169,15 +169,19 @@ export class UIElement {
169169 * Shows if element is displayed. Returns true or false. If the element doesn't exist it will return false
170170 */
171171 public async isDisplayed ( ) {
172- const displaySize = await this . _driver . getWindowSize ( ) ;
173172 const el = this . _element ;
174173 let isDisplayed = true ;
175174 if ( ! el || el === null ) {
176175 return false ;
177176 }
177+ const isDisplayedWebDriver = await el . isDisplayed ( ) ;
178+ if ( ! isDisplayedWebDriver ) {
179+ return false ;
180+ }
181+ const displaySize = await this . _driver . getWindowSize ( ) ;
178182 try {
179183 const elemCoordinates = await el . getLocation ( ) ;
180- const isDisplayedWebDriver = await el . isDisplayed ( ) ;
184+
181185 isDisplayed = isDisplayedWebDriver && elemCoordinates . x >= 0 && elemCoordinates . x < displaySize . width
182186 && elemCoordinates . y >= 0 && elemCoordinates . y < displaySize . height ;
183187 } catch ( error ) {
You can’t perform that action at this time.
0 commit comments