Well, there is a kind of solution, I really don't like it, but it's something instead of nothing.
The idea is to use a smarter "sleep", there is a waitUntil() method that takes anonymous function and timeout values ββin milliseconds. What it does is it starts this passed function in a loop until a timeout arrives, or your function returns True . This way you can run something and wait for a context change:
$this->waitUntil(function () { if ($this->byCssSelector('h1')) { return true; } return null; }, 5000);
Anyway, I will be glad if someone gives a better solution.
Pavel source share