chrome-php / chrome

Instrument headless chrome/chromium instances from PHP
MIT License
2.25k stars 276 forks source link

waitUntilContainsElement with logical operator? #607

Closed RenissonSilva closed 7 months ago

RenissonSilva commented 7 months ago

Is there a way to use "waitUntilContainsElement" with a logical operator where if one of the conditions is true it continues the process?

The problem is that I'm doing a submit, when it works, a div appears with some information, and when it goes wrong, a toast message appears informing the error.

divinity76 commented 7 months ago
while($page->evaluate("document.querySelectorAll('element1,element2').length")->getReturnValue() < 1){
    sleep(1);
}
RenissonSilva commented 7 months ago
while($page->evaluate("document.querySelectorAll('element1,element2').length")->getReturnValue() < 1){
    sleep(1);
}

Thank you, worked perfectly