无法在量角器中为变量提供外部变量

时间:2017-04-25 05:45:24

标签: javascript protractor

 self.getDocumentCount().then(function (text) {
        var stringArray = text.split("(");
        count = stringArray[0].trim();
    }).then(function () {
        self.logger.info("Document text : " + count, self);
    });
    self.logger.info("Checking the count again : " + count, self);

我无法获得超出承诺的价值。即代码片段中的最后一个计数变量

我正在使用量角器+ javascript + jasmine

1 个答案:

答案 0 :(得分:-1)

你试过这个吗?

var tempObject = {}

it('should get count', function() {
      getDocumentCount(strDoc);
});

it('should display count', function() {
      console.log(tempObject.Count);
});

function = getDocumentCount(text) {
    var stringArray = text.split("(");
    tempObject.Count = stringArray[0].trim();
})