How to get the count of the element returned bythis.remote.findAllByXpath()
in intern js (leadfoot).
Asked
Active
Viewed 154 times
0

CodeBlooded
- 185
- 5
- 16
-
Read the length? – epascarello Mar 10 '17 at 16:49
-
Yes read the length – CodeBlooded Mar 10 '17 at 16:59
-
I mean read the `.length`.... like the property. – epascarello Mar 10 '17 at 17:04
-
yes but seems like `.length` dosent work – CodeBlooded Mar 10 '17 at 17:06
1 Answers
1
I just played with leadfoot so not an expert but wouldn't it be something like this?
foo.findAllByXpath('/html/body/div')
.then(function (rows) {
console.log(rows.length);
});

epascarello
- 204,599
- 20
- 195
- 236
-
This is correct. The `findAllBy` methods will resolve to an array of the found items, so just look at the array length to get the number of elements. – jason0x43 Mar 10 '17 at 18:02
-
I tried this before but was not working at that time. may be i was missing something. – CodeBlooded Mar 11 '17 at 12:55