FIX When waiting for text to show on page, look for elements until we find one that is visible instead (#211)

of failing if the first element is invisible.
This commit is contained in:
Tim Oliver 2022-03-29 14:10:29 +13:00 committed by GitHub
parent 8ff1ef7a59
commit 261f88dd19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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;
});
}