lib/WebDriverExpectedCondition.php
public static function elementToBeClickable(WebDriverBy $by)
    {
        $visibility_of_element_located =
            self::visibilityOfElementLocated($by);

        return new static(
            function (WebDriver $driver) use ($visibility_of_element_located) {
                $element = call_user_func(
                    $visibility_of_element_located->getApply(),
                    $driver
                );
                try {
                    if ($element !== null && $element->isEnabled()) {
                        return $element;
                    }

                    return null;
                } catch (StaleElementReferenceException $e) {
                    return null;
                }
            }
        );
    }
public static function elementToBeClickable(WebDriverBy $by)
    {
        $visibility_of_element_located =
            self::visibilityOfElementLocated($by);

        return new static(
            function (WebDriver $driver) use ($visibility_of_element_located) {
                $element = call_user_func(
                    $visibility_of_element_located->getApply(),
                    $driver
                );
                try {
                    if ($element !== null && $element->isEnabled()) {
                        return $element;
                    }

                    return null;
                } catch (StaleElementReferenceException $e) {
                    return null;
                }
            }
        );
    }
public static function elementToBeClickable ( WebDriverBy $ by ) { $ visibility_of_element_located = self :: visibilityOfElementLocated ( $ by ) ; return new static ( function ( WebDriver $ driver ) use ( $ visibility_of_element_located ) { $ element = call_user_func ( $ visibility_of_element_located -> getApply ( ) , $ driver ) ; try { if ( $ element !== null && $ element -> isEnabled ( ) ) { return $ element ; } return null ; } catch ( StaleElementReferenceException $ e ) { return null ; } } ) ; }
An expectation for checking an element is visible and enabled such that you can click it.

@param WebDriverBy $by The locator used to find the element
@return static Condition return the WebDriverElement once it is located, visible and clickable.
An expectation for checking an element is visible and enabled such that you can click it .