我正在尝试访问此元素中的文本。每当我获得函数的返回值或将结果存储在变量中时,我都会在打印到控制台时得到“{state:'pending'}” 。有谁知道我做错了什么?请原谅我的无知。
describe('End to End for 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 with valid credentials', function interactWithPage(){
this.timeout(maxWait)
//Check if element is 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 from attribute
return browser.elementById(objectRepo.loginObjects.androidUserIdField).getAttribute("text")
})
.then(function fulfilledPromise(){
console.log(getUserId())
console.log("Working")
},function rejectedPromise(){
//If promise in the chain is rejected
console.log("Not Working")
})
});
});