/** * * Returns true if at least one element is existing by given selector * * :index.html
:isExisting.js 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 }); *
* * @alias browser.isExisting * @param {String} selector DOM-element * @return {Boolean|Boolean[]} true if element(s)* [is|are] existing * @uses protocol/elements * @type state * */ let isExisting = function (selector) { return this.elements(selector).then((res) => { if (Array.isArray(res.value) && res.value.length > 0) { return true } return false }) } export default isExisting