Skip to main content

Posts

Showing posts from October, 2015

Making 'Wikipedia' example for Behat to work - autocomplete ugly workaround

In documentation you can see there is a scenario with autocomplete http://docs.behat.org/en/v2.5/cookbook/behat_and_mink.html But this scenario won't work because of this line: When I fill in " search " with " Behavior Driv " The line only sets value of the input to " Behavior Driv " but autocomplete feature won't be triggered. To fix this we introduce new keyword: When I type "Behavior Driv" into search box Adding implementation to FeatureContext :      /**      * @Then I type :text into search box      */     public function iTypeTextIntoSearchBox($text)     {         $element = $this->getSession()->getPage()->findById('searchInput');         $script = "$('#searchInput').keypress();";         $element->setValue($text);         $this->getSession()->evaluateScript($script);     } Here after setting value to our text we execute jQuery's ' keypress ' event as a