When waiting for text to show on page, look for elements until we find one that is visible instead

of failing if the first element is invisible.
This commit is contained in:
Tim Oliver 2022-03-29 09:26:56 +13:00
parent e2deed514e
commit 8c07593588

View File

@ -1151,16 +1151,20 @@ JS;
$page = $this->getSession()->getPage();
$session = $this->getSession();
$this->spin(function () use ($page, $session, $text) {
$element = $page->find(
$elements = $page->findAll(
'xpath',
$session->getSelectorsHandler()->selectorToXpath("xpath", ".//*[contains(text(), '$text')]")
);
if (empty($element)) {
return false;
} else {
return ($element->isVisible());
foreach ($elements as $element) {
if (empty($element)) {
continue;
}
if (!$element->isVisible()) {
continue;
}
return true;
}
return false;
});
}