public function findElement(string $selector, int $timeout = 5, TraversableElement $baseElement = null): NodeElement
    {
        $baseElement = $baseElement ?? $this->getSession()->getPage();

        try {
            return $this->waitUntil($timeout,
                function () use ($selector, $baseElement) {
                    return $baseElement->find('css', $selector);
                });
        } catch (Exception $e) {
            throw new ElementNotFoundException($this->getSession()->getDriver(), null, 'css', $selector);
        }
    }
public function findElement(string $selector, int $timeout = 5, TraversableElement $baseElement = null): NodeElement
    {
        $baseElement = $baseElement ?? $this->getSession()->getPage();

        try {
            return $this->waitUntil($timeout,
                function () use ($selector, $baseElement) {
                    return $baseElement->find('css', $selector);
                });
        } catch (Exception $e) {
            throw new ElementNotFoundException($this->getSession()->getDriver(), null, 'css', $selector);
        }
    }
public function findElement ( string $ selector , int $ timeout = 5 , TraversableElement $ baseElement = null ) : NodeElement { $ baseElement = $ baseElement ?? $ this -> getSession ( ) -> getPage ( ) ; try { return $ this -> waitUntil ( $ timeout , function ( ) use ( $ selector , $ baseElement ) { return $ baseElement -> find ( 'css' , $ selector ) ; } ) ; } catch ( Exception $ e ) { throw new ElementNotFoundException ( $ this -> getSession ( ) -> getDriver ( ) , null , 'css' , $ selector ) ; } }
Adopted Mink find function to find one element that might still be loading.

@param string $selector CSS selector for the element
@param int $timeout
@param TraversableElement|null $baseElement Element from which the DOM will be searched

@return NodeElement Searched element

@throws ElementNotFoundException
Adopted Mink find function to find one element that might still be loading .