public function beforeJavascriptStep($event)
    {
        /** @var \Behat\Behat\Hook\Scope\BeforeStepScope $event */
        // Make sure the feature is registered in case this hook fires before
        // ::registerFeature() which is also a @BeforeStep. Behat doesn't
        // support ordering hooks.
        $this->registerFeature($event);
        if (!$this->hasTag('javascript')) {
            return;
        }
        $text = $event->getStep()->getText();
        if (preg_match('/(follow|press|click|submit)/i', $text)) {
            $this->iWaitForAjaxToFinish($event);
        }
    }
public function beforeJavascriptStep($event)
    {
        /** @var \Behat\Behat\Hook\Scope\BeforeStepScope $event */
        // Make sure the feature is registered in case this hook fires before
        // ::registerFeature() which is also a @BeforeStep. Behat doesn't
        // support ordering hooks.
        $this->registerFeature($event);
        if (!$this->hasTag('javascript')) {
            return;
        }
        $text = $event->getStep()->getText();
        if (preg_match('/(follow|press|click|submit)/i', $text)) {
            $this->iWaitForAjaxToFinish($event);
        }
    }
public function beforeJavascriptStep ( $ event ) { /** @var \Behat\Behat\Hook\Scope\BeforeStepScope $event */ // Make sure the feature is registered in case this hook fires before // ::registerFeature() which is also a @BeforeStep. Behat doesn't // support ordering hooks. $ this -> registerFeature ( $ event ) ; if ( ! $ this -> hasTag ( 'javascript' ) ) { return ; } $ text = $ event -> getStep ( ) -> getText ( ) ; if ( preg_match ( '/(follow|press|click|submit)/i' , $ text ) ) { $ this -> iWaitForAjaxToFinish ( $ event ) ; } }
For javascript enabled scenarios, always wait for AJAX before clicking.

@BeforeStep
For javascript enabled scenarios always wait for AJAX before clicking .