protected function ensure_element_exists($element, $selectortype) {

        // Getting the behat selector & locator.
        list($selector, $locator) = $this->transform_selector($selectortype, $element);

        // Exception if it timesout and the element is still there.
        $msg = 'The "' . $element . '" element does not exist and should exist';
        $exception = new ExpectationException($msg, $this->getSession());

        // It will stop spinning once the find() method returns true.
        $this->spin(
            function($context, $args) {
                // We don't use behat_base::find as it is already spinning.
                if ($context->getSession()->getPage()->find($args['selector'], $args['locator'])) {
                    return true;
                }
                return false;
            },
            array('selector' => $selector, 'locator' => $locator),
            self::get_extended_timeout(),
            $exception,
            true
        );

    }
protected function ensure_element_exists($element, $selectortype) {

        // Getting the behat selector & locator.
        list($selector, $locator) = $this->transform_selector($selectortype, $element);

        // Exception if it timesout and the element is still there.
        $msg = 'The "' . $element . '" element does not exist and should exist';
        $exception = new ExpectationException($msg, $this->getSession());

        // It will stop spinning once the find() method returns true.
        $this->spin(
            function($context, $args) {
                // We don't use behat_base::find as it is already spinning.
                if ($context->getSession()->getPage()->find($args['selector'], $args['locator'])) {
                    return true;
                }
                return false;
            },
            array('selector' => $selector, 'locator' => $locator),
            self::get_extended_timeout(),
            $exception,
            true
        );

    }
protected function ensure_element_exists ( $ element , $ selectortype ) { // Getting the behat selector & locator. list ( $ selector , $ locator ) = $ this -> transform_selector ( $ selectortype , $ element ) ; // Exception if it timesout and the element is still there. $ msg = 'The "' . $ element . '" element does not exist and should exist' ; $ exception = new ExpectationException ( $ msg , $ this -> getSession ( ) ) ; // It will stop spinning once the find() method returns true. $ this -> spin ( function ( $ context , $ args ) { // We don't use behat_base::find as it is already spinning. if ( $ context -> getSession ( ) -> getPage ( ) -> find ( $ args [ 'selector' ] , $ args [ 'locator' ] ) ) { return true ; } return false ; } , array ( 'selector' => $ selector , 'locator' => $ locator ) , self :: get_extended_timeout ( ) , $ exception , true ) ; }
Spins around an element until it exists

@throws ExpectationException
@param string $element
@param string $selectortype
@return void
Spins around an element until it exists