Search code examples
behat

how to press Enter key in Behat


I am new to behat and I am stuck in a place where I need to enter texts in a field and then I have to hit enter to add the item to the list.

I am not able to find a solution in Behat. Please help if anyone know about this?


Solution

  • Sorry I found the solution in mink document which is quite straightforward. So the answer is:

    $this->getSession()
          ->getPage()
          ->findById($id_of_field)
          ->keyPress($unicode_of_the_key);