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 {
169
169
* Shows if element is displayed. Returns true or false. If the element doesn't exist it will return false
170
170
*/
171
171
public async isDisplayed ( ) {
172
- const displaySize = await this . _driver . getWindowSize ( ) ;
173
172
const el = this . _element ;
174
173
let isDisplayed = true ;
175
174
if ( ! el || el === null ) {
176
175
return false ;
177
176
}
177
+ const isDisplayedWebDriver = await el . isDisplayed ( ) ;
178
+ if ( ! isDisplayedWebDriver ) {
179
+ return false ;
180
+ }
181
+ const displaySize = await this . _driver . getWindowSize ( ) ;
178
182
try {
179
183
const elemCoordinates = await el . getLocation ( ) ;
180
- const isDisplayedWebDriver = await el . isDisplayed ( ) ;
184
+
181
185
isDisplayed = isDisplayedWebDriver && elemCoordinates . x >= 0 && elemCoordinates . x < displaySize . width
182
186
&& elemCoordinates . y >= 0 && elemCoordinates . y < displaySize . height ;
183
187
} catch ( error ) {
You can’t perform that action at this time.
0 commit comments