jeudi 1 octobre 2015

Protractor - count elements in xpath and store it to var

I need to store the value of number of records from the table in some variable in order to use it lately. For now tried to simple print number of records like this:

    var rows = element.all(by.xpath('//*[@id="content"]/div/div/table/tbody/tr'));
    var sum = rows.count();
    console.log(sum.getText());

or like that:

element.all(by.xpath('//*[@id="content"]/div/div/table/tbody/tr')).count().then(function(count) { console.log(count); });

but each time I am getting Failed: object is not a function. Anyone could help with that ?

Tried solutions from this thread: Protractor - count elements in repeater and print it - but did not work.

Aucun commentaire:

Enregistrer un commentaire