var waiting_text="Basic Data";
var max_waiting_time=30;//seconds
for(i=0;i<max_waiting_time;i++)
{
body_text= await driver.findElement(webdriver.By.tagName("body")).getText();
if(body_text.includes(waiting_text))
{
console.log("Found required text["+waiting_text+"] at the "+i+"th seconds, exiting the waiting ");
break;
}else{
await commands.wait.byTime(1000);
}
}
if(i>=max_waiting_time)
{
console.log("Coul not find text["+waiting_text+"] at the "+i+"th seconds, exiting the waiting ");
}
Sitespeed – a script to wait for text
2023-01-18