{"action":"created","issue":{"url":"https://api.github.com/repos/Behat/MinkExtension/issues/257","repository_url":"https://api.github.com/repos/Behat/MinkExtension","labels_url":"https://api.github.com/repos/Behat/MinkExtension/issues/257/labels{/name}","comments_url":"https://api.github.com/repos/Behat/MinkExtension/issues/257/comments","events_url":"https://api.github.com/repos/Behat/MinkExtension/issues/257/events","html_url":"https://github.com/Behat/MinkExtension/issues/257","id":178589081,"number":257,"title":"fillField function is always losing the focus of an element when triggered","user":{"login":"kwoxer","id":1167229,"avatar_url":"https://avatars.githubusercontent.com/u/1167229?v=3","gravatar_id":"","url":"https://api.github.com/users/kwoxer","html_url":"https://github.com/kwoxer","followers_url":"https://api.github.com/users/kwoxer/followers","following_url":"https://api.github.com/users/kwoxer/following{/other_user}","gists_url":"https://api.github.com/users/kwoxer/gists{/gist_id}","starred_url":"https://api.github.com/users/kwoxer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kwoxer/subscriptions","organizations_url":"https://api.github.com/users/kwoxer/orgs","repos_url":"https://api.github.com/users/kwoxer/repos","events_url":"https://api.github.com/users/kwoxer/events{/privacy}","received_events_url":"https://api.github.com/users/kwoxer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":18,"created_at":"2016-09-22T11:50:40Z","updated_at":"2016-09-23T10:09:15Z","closed_at":null,"body":"Versions:\r\n```\r\n    \"cweagans/composer-patches\": \"~1.0\",\r\n    \"drupal/drupal-extension\": \"3.2.2\",\r\n    \"behat/mink-selenium2-driver\": \"1.3.1\",\r\n    \"jarnaiz/behat-junit-formatter\": \"1.3.2\",\r\n    \"emuse/behat-html-formatter\": \"0.1.0\"\r\n```\r\n\r\nI was reading https://github.com/Behat/Behat/issues/96 and would like to have those:\r\n\r\n```\r\n  When I bring the focus to input field \"<id>\"\r\n  When I type \"<text>\" in input field \"<id>\"\r\n```\r\nBut they do not exists and any way to try to create them on my own failed.\r\n\r\nSo my current state of my own function:\r\n\r\n```\r\n/**\r\n   * @Given I give focus to the css selector :selector\r\n   */\r\n  public function iGiveFocusToTheCssSelector($css_selector)\r\n  {\r\n    $element = $this->getSession()->getPage()->find(\"css\", $css_selector);\r\n    if ($css_selector === NULL) {\r\n      throw new \\Exception(sprintf('Could not evaluate CSS Selector: \"%s\"', $element, $this->getSession()->getCurrentUrl()));\r\n    }\r\n\r\n    $element->click();\r\n    $element->fillField(\"some-field\",\"some text...\");\r\n  }\r\n```\r\nIt works. It selects the field and types in the text. But it is always loosing focus of that field. Also If I directly try to press enter directly afterwards with:\r\n\r\n```\r\n    $script = \"jQuery.event.trigger({ type : 'keypress', which : '13' });\";\r\n    $this->getSession()->evaluateScript($script);\r\n```\r\n\r\nit has still looses the focus and nothing happens anymore.\r\n\r\nIs there a way to stop Behat/Mink from loosing the focus on fields? Why is it loosing the focus? It does not really makes sense to me.\r\n\r\nAnd the reason why it is so important to me, is because I'm waiting for the suggesting box that pops out just when the focus of the field is given.\r\n\r\nAlso found this one https://www.drupal.org/node/2112797 but it's already some years ago and I have a different issue."},"comment":{"url":"https://api.github.com/repos/Behat/MinkExtension/issues/comments/249153635","html_url":"https://github.com/Behat/MinkExtension/issues/257#issuecomment-249153635","issue_url":"https://api.github.com/repos/Behat/MinkExtension/issues/257","id":249153635,"user":{"login":"kwoxer","id":1167229,"avatar_url":"https://avatars.githubusercontent.com/u/1167229?v=3","gravatar_id":"","url":"https://api.github.com/users/kwoxer","html_url":"https://github.com/kwoxer","followers_url":"https://api.github.com/users/kwoxer/followers","following_url":"https://api.github.com/users/kwoxer/following{/other_user}","gists_url":"https://api.github.com/users/kwoxer/gists{/gist_id}","starred_url":"https://api.github.com/users/kwoxer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kwoxer/subscriptions","organizations_url":"https://api.github.com/users/kwoxer/orgs","repos_url":"https://api.github.com/users/kwoxer/repos","events_url":"https://api.github.com/users/kwoxer/events{/privacy}","received_events_url":"https://api.github.com/users/kwoxer/received_events","type":"User","site_admin":false},"created_at":"2016-09-23T10:09:14Z","updated_at":"2016-09-23T10:09:14Z","body":"Thanks, that works perfectly.\r\n\r\nAnd the other issue with hitting Enter? :)"}}
{"actor":{"display_login":"kwoxer"}}