(Appium - JavaScript - Mocha - Promises) Returns "{state:'pending'}" instead of element text -
i attempting access text within element. anytime return value of function or store results in variable, "{state:'pending'}" when printing console. does have idea of doing incorrectly? please, excuse ignorance.
describe('end end single declined applicant', function endtoend(){ var browser; //initialize session before('establishing server connection', function establishconnection(){ browser = wd.promisechainremote("127.0.0.1", 4723) return browser.init(desired) .then(function goodconnection(){ console.log("connection established") },function badconnection(){ console.log("connection failed") }); }); describe('login page', function loginpage(){ it('should login valid credentials', function interactwithpage(){ this.timeout(maxwait) //check if element available return browser.waitforelementbyid(objectrepo.loginobjects.androiduseridfield, wait, pollrate) .then(function enteruserid(){ //input text return browser.elementbyid(objectrepo.loginobjects.androiduseridfield).type(objectrepo.myinputs.userid) }) .then(function getuserid(){ //get text attribute return browser.elementbyid(objectrepo.loginobjects.androiduseridfield).getattribute("text") }) .then(function fulfilledpromise(){ console.log(getuserid()) console.log("working") },function rejectedpromise(){ //if promise in chain rejected console.log("not working") }) }); });
Comments
Post a Comment