src/Services/WaitForElement.php
protected function waitForElement($type, $value, $timeout)
    {
        if (!in_array($type, $this->waitForTypes)) {
            throw new \Exception('Invalid wait for element type to wait for on the page');
        }

        $webdriver = $this;
        $this->waitUntil(function () use ($type, $value, $webdriver) {
            $function = 'by'.$type;

            try {
                $webdriver->$function($value);

                return true;
            } catch (\Exception $e) {
                return; // haven't found the element yet
            }
        }, $timeout);
    }
protected function waitForElement($type, $value, $timeout)
    {
        if (!in_array($type, $this->waitForTypes)) {
            throw new \Exception('Invalid wait for element type to wait for on the page');
        }

        $webdriver = $this;
        $this->waitUntil(function () use ($type, $value, $webdriver) {
            $function = 'by'.$type;

            try {
                $webdriver->$function($value);

                return true;
            } catch (\Exception $e) {
                return; // haven't found the element yet
            }
        }, $timeout);
    }
protected function waitForElement ( $ type , $ value , $ timeout ) { if ( ! in_array ( $ type , $ this -> waitForTypes ) ) { throw new \ Exception ( 'Invalid wait for element type to wait for on the page' ) ; } $ webdriver = $ this ; $ this -> waitUntil ( function ( ) use ( $ type , $ value , $ webdriver ) { $ function = 'by' . $ type ; try { $ webdriver -> $ function ( $ value ) ; return true ; } catch ( \ Exception $ e ) { return ; // haven't found the element yet } } , $ timeout ) ; }
Generalized WaitsFor function to wait for a specific element with value
by the type passed.

@param $type The type of selector we are using to wait for
@param $value The value of the selector we are using
@param $timeout

@throws \Exception
Generalized WaitsFor function to wait for a specific element with value by the type passed .