예제 #1
0
 public function waitForAlert()
 {
     $this->webDriver->wait()->until(WebDriverExpectedCondition::alertIsPresent());
 }
예제 #2
0
 /**
  * Executes JavaScript and waits up to $timeout seconds for it to return true.
  *
  * In this example we will wait up to 60 seconds for all jQuery AJAX requests to finish.
  *
  * ``` php
  * <?php
  * $I->waitForJS("return $.active == 0;", 60);
  * ?>
  * ```
  *
  * @param string $script
  * @param int $timeout seconds
  */
 public function waitForJS($script, $timeout = 5)
 {
     $condition = function ($wd) use($script) {
         return $wd->executeScript($script);
     };
     $this->webDriver->wait($timeout)->until($condition);
 }
예제 #3
0
 /**
  * Wait until a condition is met.
  *
  * @param     $func    (closure|WebDriverExpectedCondition)
  * @param int $timeout
  *
  * @throws \Exception
  *
  * @return $this
  */
 protected function waitUntil($func, $timeout = 10)
 {
     $this->driver->wait($timeout)->until($func);
     return $this;
 }