【问题标题】:Get Number of element returned by findAllByXpath in leadfoot获取leadfoot中findAllByXpath返回的元素数
【发布时间】:2017-03-10 16:46:48
【问题描述】:

如何获取intern js(leadfoot)中this.remote.findAllByXpath()返回的元素的计数。

【问题讨论】:

  • 阅读长度?
  • 是的阅读长度
  • 我的意思是阅读.length.... 喜欢的属性。
  • 是的,但看起来像 .length 剂量工作

标签: javascript arrays promise intern leadfoot


【解决方案1】:

我刚玩过leadfoot,所以不是专家,但不会是这样吗?

foo.findAllByXpath('/html/body/div')
    .then(function (rows) {
        console.log(rows.length);
    });

【讨论】:

  • 这是正确的。 findAllBy 方法将解析为找到的项目的数组,因此只需查看数组长度即可获取元素数。
  • 我之前试过这个,但当时没有工作。可能是我错过了什么。
猜你喜欢
  • 1970-01-01
  • 2023-04-06
  • 2012-02-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多