示例#1
0
 /**
  * Waits for element to not be visible on the page for $timeout seconds to pass.
  * If element stays visible, timeout exception is thrown.
  *
  * ``` php
  * <?php
  * $I->waitForElementNotVisible('#agree_button', 30); // secs
  * ?>
  * ```
  *
  * @param $element
  * @param int $timeout seconds
  * @throws \Exception
  */
 public function waitForElementNotVisible($element, $timeout = 10)
 {
     $condition = null;
     if (Locator::isID($element)) {
         $condition = \WebDriverExpectedCondition::invisibilityOfElementLocated(\WebDriverBy::id(substr($element, 1)));
     }
     if (!$condition and Locator::isCSS($element)) {
         $condition = \WebDriverExpectedCondition::invisibilityOfElementLocated(\WebDriverBy::cssSelector($element));
     }
     if (Locator::isXPath($element)) {
         $condition = \WebDriverExpectedCondition::invisibilityOfElementLocated(\WebDriverBy::xpath($element));
     }
     if (!$condition) {
         throw new \Exception("Only CSS or XPath allowed");
     }
     $this->webDriver->wait($timeout)->until($condition);
 }
示例#2
0
 /**
  * Waits up to $timeout seconds for the given element to become invisible.
  * If element stays visible, a timeout exception is thrown.
  *
  * ``` php
  * <?php
  * $I->waitForElementNotVisible('#agree_button', 30); // secs
  * ?>
  * ```
  *
  * @param $element
  * @param int $timeout seconds
  * @throws \Exception
  */
 public function waitForElementNotVisible($element, $timeout = 10)
 {
     $condition = \WebDriverExpectedCondition::invisibilityOfElementLocated($this->getLocator($element));
     $this->webDriver->wait($timeout)->until($condition);
 }