У меня было похожее состояние. Но мне нужно было просто извлечь значение из DOM и сравнить его с ожидаемым результатом, это выглядит так:
records = await targeting_page.records.getText();
recordsNumber = parseFloat(records.replace(/,/g, ''));
recordsRange = recordsNumber >= 100 && recordsNumber < 90000000;
await expect(recordsRange).toEqual(true);
но ваш случай не большая разница.
то, что я написал в консоли браузера на этой странице вашего вопроса
async function fin() {
for(var i = 0; i < 100; i++) {
var myElement = document.querySelector("code span:nth-child(27)").textContent //your find your desired element
console.log(b)
typeof b == 'string' ? console.log(true) : console.log(false) //this is optionally
var res = parseFloat(b) //parse when it will be 12:00 you will get the 12 number
console.log(res)
res == 13 ? await b.click() : console.log("The button is not ready yet") //and here compare is there that number you need, if yes then click element(this doesn't work in console,
// if you use async/await in your protractor tests, there are it will work
}
}
fin()
Вот что касается непосредственно этой страницы.
В тесте это будет выглядеть примерно так (может быть, намного лучше, но я очень быстро его написал):
for(let i=0; i < 100; i++) {
var myE = await myElement.getText(); //where myElement -- your selector
var myNumber = parseFloat(myE.replace(/:/g, '')); // parse and get 12 out of "12:00"
if (myNumber == 12) {
await myElement.click()
} else {
console.log("The button is not ready yet")
}
}