selenium webdriver - TypeError: WebElementCondition did not resolve to a WebElement: [object Object] -
issue: in particular webpage want wait particular element , perform operation on element.
code used:
//official webapp url browser.driver.get('http://ubet-feature-qa.opal.dnb.com'); // variable particular element var usernamedisplayedonhomepagefield = element(by.css('[ng-if="authsrv.getusername()"]')); //function wait element , return element availability this.isloggedin = function(){ browser.driver.wait(protractor.until.elementisvisible(usernamedisplayedonhomepagefield)); return usernamedisplayedonhomepagefield.isdisplayed(); };
expected result: should return element availability either true or false
actual result: getting below error message, not sure why this..
typeerror: webelementcondition did not resolve webelement: [object object]
a selenium condition cannot resolve protractor elementfinder
.
you use protractor.expectedconditions
instead of protractor.until
condition:
var ec = protractor.expectedconditions; var button = element(by.css("...")); browser.wait(ec.visibilityof(button), 1000); button.click();
you use selenium element selenium condition:
var until = protractor.until; var button = browser.findelement(by.css("...")); browser.wait(until.elementisvisible(button), 1000).then(function(button){ button.click(); });
and way webelement
elementfinder
:
var until = protractor.until; var button = element(by.css("...")); browser.wait(until.elementisvisible(button.getwebelement()), 1000).then(function(button){ button.click(); });
Comments
Post a Comment