mercredi 26 avril 2017

Protractor: How to store number text from div element

I'm using Protractor and Angular page. On the page there are each time displayed random 5 selected numbers out of 50 available. How can I store text for each of those 5 numbers into one variable? All selected numbers have one attribute and its value in common.

HTML:

<div class="basic-number-selected" ...</div>

Page object file:

this.selectedNumbers = element.all(by.css('div.basic-number-selected'));

Do any of you have an idea how can I store text of each selected number?

I've tried with each, but without any success:

var numbers = [];

page.selectedNumbers.getText().each(function(num) {
    numbers.push(num);
});

console.log("Selected numbers: " + numbers);




Aucun commentaire:

Enregistrer un commentaire