量角器元素(by.binding('***')).getText() 返回对象而不是字符串



对于下面的量角器摩卡测试用例,greeting.getText(( 将始终返回
低于结果而不是字符串。谁能给我这方面的线索?

   describe('angularjs home', function () {
        it('Should welcome a user', function (done) {
            browser.get('http://www.angularjs.org');
            element(by.model('yourName')).sendKeys('tanshuai');    
            var greeting = element(by.binding('yourName'));
            console.log(greeting.getText());
            expect(greeting.getText()).to.eventually.equal('Hello tanshuai!');
        });
    });

控制台.log输出===

=============
  ElementFinder {
      browser_:
       ProtractorBrowser {
         controlFlow: [Function],
         schedule: [Function],
         setFileDetector: [Function],
         getExecutor: [Function],
      ................................
      getId: [Function],
      takeScreenshot: [Function] }

角器:element.getText(( 返回一个对象而不是字符串

看起来getText()返回了一个承诺,您需要解决它。查看上面的链接

最新更新