isExisting

Returns true if at least one element is existing by given selector

Usage

1
browser.isExisting(selector);

Parameters

Param Type Details
selector String DOM-element

Example

index.html
1
2
3
4
<div id="notDisplayed" style="display: none"></div>
<div id="notVisible" style="visibility: hidden"></div>
<div id="notInViewport" style="position:absolute; left: 9999999"></div>
<div id="zeroOpacity" style="opacity: 0"></div>
isExisting.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
it('should detect if elements are existing', function () {
var isExisting;
isExisting = browser.isExisting('#someRandomNonExistingElement');
console.log(isExisting); // outputs: false

isExisting = browser.isExisting('#notDisplayed');
console.log(isExisting); // outputs: true

isExisting = browser.isExisting('#notVisible');
console.log(isExisting); // outputs: true

isExisting = browser.isExisting('#notInViewport');
console.log(isExisting); // outputs: true

isExisting = browser.isExisting('#zeroOpacity');
console.log(isExisting); // outputs: true
});

Uses