public function findWithWait($selector, $baseElement = null, $checkVisibility = true)
    {
        if (!$baseElement) {
            $baseElement = $this->getSession()->getPage();
        }
        $element = $this->spin(
            function () use ($selector, $baseElement, $checkVisibility) {
                $element = $baseElement->find('css', $selector);
                if (!$element) {
                    throw new \Exception("Element with selector '$selector' was not found");
                }
                // An exception may be thrown if the element is not valid/attached to DOM.
                $element->getValue();

                if ($checkVisibility && !$element->isVisible()) {
                    throw new \Exception("Element with selector '$selector' is not visible");
                }

                return $element;
            }
        );

        return $element;
    }
public function findWithWait($selector, $baseElement = null, $checkVisibility = true)
    {
        if (!$baseElement) {
            $baseElement = $this->getSession()->getPage();
        }
        $element = $this->spin(
            function () use ($selector, $baseElement, $checkVisibility) {
                $element = $baseElement->find('css', $selector);
                if (!$element) {
                    throw new \Exception("Element with selector '$selector' was not found");
                }
                // An exception may be thrown if the element is not valid/attached to DOM.
                $element->getValue();

                if ($checkVisibility && !$element->isVisible()) {
                    throw new \Exception("Element with selector '$selector' is not visible");
                }

                return $element;
            }
        );

        return $element;
    }
public function findWithWait ( $ selector , $ baseElement = null , $ checkVisibility = true ) { if ( ! $ baseElement ) { $ baseElement = $ this -> getSession ( ) -> getPage ( ) ; } $ element = $ this -> spin ( function ( ) use ( $ selector , $ baseElement , $ checkVisibility ) { $ element = $ baseElement -> find ( 'css' , $ selector ) ; if ( ! $ element ) { throw new \ Exception ( "Element with selector '$selector' was not found" ) ; } // An exception may be thrown if the element is not valid/attached to DOM. $ element -> getValue ( ) ; if ( $ checkVisibility && ! $ element -> isVisible ( ) ) { throw new \ Exception ( "Element with selector '$selector' is not visible" ) ; } return $ element ; } ) ; return $ element ; }
Adpted Mink find function combined with a spin function
to find one element that might still be loading.

@param   string      $selector       css selector for the element
@param   \Behat\Mink\Element\NodeElement $baseElement    base Mink node element from where the find should be called

@return  \Behat\Mink\Element\NodeElement
Adpted Mink find function combined with a spin function to find one element that might still be loading .