public function logOut()
    {
        /*
         * Using NodeElement::mouseOver() won't work because WordPress is using hoverIndent.
         * Instead we just manually add the hover class.
         *
         * See https://github.com/paulgibbs/behat-wordpress-extension/issues/65
         */
        try {
            $element_exists = $this->getSession()->evaluateScript(
                'return document.getElementById("wp-admin-bar-my-account");'
            );

            if ($element_exists !== null) {
                $this->getSession()->executeScript(
                    'document.getElementById("wp-admin-bar-my-account").classList.add("hover");'
                );

                $this->find('css', '#wp-admin-bar-logout a')->click();
            }
        } catch (UnsupportedDriverActionException $e) {
            // This will fail for GoutteDriver but neither is it necessary.
            $this->find('css', '#wp-admin-bar-logout a')->click();
        }
    }
public function logOut()
    {
        /*
         * Using NodeElement::mouseOver() won't work because WordPress is using hoverIndent.
         * Instead we just manually add the hover class.
         *
         * See https://github.com/paulgibbs/behat-wordpress-extension/issues/65
         */
        try {
            $element_exists = $this->getSession()->evaluateScript(
                'return document.getElementById("wp-admin-bar-my-account");'
            );

            if ($element_exists !== null) {
                $this->getSession()->executeScript(
                    'document.getElementById("wp-admin-bar-my-account").classList.add("hover");'
                );

                $this->find('css', '#wp-admin-bar-logout a')->click();
            }
        } catch (UnsupportedDriverActionException $e) {
            // This will fail for GoutteDriver but neither is it necessary.
            $this->find('css', '#wp-admin-bar-logout a')->click();
        }
    }
public function logOut ( ) { /*
         * Using NodeElement::mouseOver() won't work because WordPress is using hoverIndent.
         * Instead we just manually add the hover class.
         *
         * See https://github.com/paulgibbs/behat-wordpress-extension/issues/65
         */ try { $ element_exists = $ this -> getSession ( ) -> evaluateScript ( 'return document.getElementById("wp-admin-bar-my-account");' ) ; if ( $ element_exists !== null ) { $ this -> getSession ( ) -> executeScript ( 'document.getElementById("wp-admin-bar-my-account").classList.add("hover");' ) ; $ this -> find ( 'css' , '#wp-admin-bar-logout a' ) -> click ( ) ; } } catch ( UnsupportedDriverActionException $ e ) { // This will fail for GoutteDriver but neither is it necessary. $ this -> find ( 'css' , '#wp-admin-bar-logout a' ) -> click ( ) ; } }
Logs-out using the toolbar log-out link.
Logs - out using the toolbar log - out link .