当我在 protractor 的 console.log 中做 getText 时,ElementFinder 错误。

问题描述 投票:0回答:1

我想做一个 element.all 这样

element.all(by.className('col-md-4 ng-scope')).all(by.className('chart-small-titles dashboard-alignment ng-binding')).then(function(items) {
           console.log(items[1].getText());
});

这段代码返回这个。

ElementFinder {
  browser_:
   ProtractorBrowser {
     controlFlow: [Function],
     schedule: [Function],
     setFileDetector: [Function],
     getExecutor: [Function],
     getSession: [Function],

还有更多这样的代码

我做错了什么?也许我用错了.all函数,我不知道。

protractor
1个回答
0
投票

可能有不同的事情出错。试试这个

element.all(by.className('col-md-4 ng-scope')).all(by.className('chart-small-titles dashboard-alignment ng-binding')).then(function(items) {
    items.get(1).getText().then(
        function (text) {
            console.log(text);
        })
    )
});
© www.soinside.com 2019 - 2024. All rights reserved.