protractor icon indicating copy to clipboard operation
protractor copied to clipboard

Failed: protractor_1.browser.driver.isElementPresent is not a function

Open gijop opened this issue 8 years ago • 1 comments

Hi, Found a new issue while using the browser.driver.isElementPresent. It was used inorder to avoid the sleep problem but still it shows an error ? Protractor version : 5.2.2 npm version : 5.5.1 node version : v8.9.3

this.testFunction= function() { var test= element(by.id('getID')); this.isLoaded(test); }; this.isLoaded = function (locator) { console.log("entered...1"); browser.wait(function () { console.log("entered...2") return browser.driver.isElementPresent(locator); //Here it shows the error },5000); };

Anybody help ?

gijop avatar Mar 21 '18 09:03 gijop

Try return element(locator).isPresent();

e.g return element(by.css('.test-h1')).isPresent();

http://www.protractortest.org/#/api?view=ElementFinder.prototype.isPresent

vsravuri avatar Mar 29 '18 23:03 vsravuri