{"action":"created","issue":{"url":"https://api.github.com/repos/Codeception/Codeception/issues/1901","labels_url":"https://api.github.com/repos/Codeception/Codeception/issues/1901/labels{/name}","comments_url":"https://api.github.com/repos/Codeception/Codeception/issues/1901/comments","events_url":"https://api.github.com/repos/Codeception/Codeception/issues/1901/events","html_url":"https://github.com/Codeception/Codeception/issues/1901","id":73457145,"number":1901,"title":"selectOption doesn't seem to select an option","user":{"login":"jrm2k6","id":1088099,"avatar_url":"https://avatars.githubusercontent.com/u/1088099?v=3","gravatar_id":"","url":"https://api.github.com/users/jrm2k6","html_url":"https://github.com/jrm2k6","followers_url":"https://api.github.com/users/jrm2k6/followers","following_url":"https://api.github.com/users/jrm2k6/following{/other_user}","gists_url":"https://api.github.com/users/jrm2k6/gists{/gist_id}","starred_url":"https://api.github.com/users/jrm2k6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrm2k6/subscriptions","organizations_url":"https://api.github.com/users/jrm2k6/orgs","repos_url":"https://api.github.com/users/jrm2k6/repos","events_url":"https://api.github.com/users/jrm2k6/events{/privacy}","received_events_url":"https://api.github.com/users/jrm2k6/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-05-05T23:01:14Z","updated_at":"2015-05-06T06:12:36Z","closed_at":null,"body":"Suite type: functional\r\nCodeception version 2.0.13\r\n\r\nI have the following html:\r\n\r\n```\r\n<html>\r\n<body>\r\n    <form>\r\n        <select name=\"test1\" id=\"test\">\r\n            <option value=\"1\">One</option>\r\n            <option value=\"2\">Two</option>\r\n            <option value=\"3\">Three</option>\r\n        </select>\r\n    </form>\r\n</body>\r\n</html>\r\n```\r\n\r\nAnd the following test:\r\n\r\n```\r\n<?php\r\n$I = new FunctionalTester($scenario);\r\n\r\n$I->amOnPage('/admin/consultations/view/1');\r\n$option = $I->grabTextFrom('form select[name=test1] option:nth-child(2)');\r\n// This prints 'Two' when calling dd()\r\n$I->selectOption(\"form select[name=test1]\", $option);\r\n//$I->seeOptionIsSelected(\"#test\", 'Two');\r\n$I->seeInField(\"#test\", 'Two');\r\n```\r\n\r\nError received:\r\n```\r\nCouldn't see in field \"#test\",\"Two\":\r\nFailed asserting that an array contains 'Two'.\r\n\r\nScenario Steps:\r\n4. I see in field \"#test\",\"Two\"\r\n3. I select option \"#test\",\"Two\"\r\n2. I grab text from \"form select[name=test1] option:nth-child(2)\"\r\n1. I am on page \"/admin/consultations/view/1\"\r\n\r\n\r\nFAILURES!\r\nTests: 4, Assertions: 1, Failures: 1.\r\n```\r\n\r\nWhen using seeOptionIsSelected instead of seeInField I got:\r\n\r\n```\r\nCouldn't see option is selected \"#test\",\"Two\":\r\nElement located either by name, CSS or XPath 'selected option' was not found on page.\r\n\r\nScenario Steps:\r\n4. I see option is selected \"#test\",\"Two\"\r\n3. I select option \"#test\",\"Two\"\r\n2. I grab text from \"form select[name=test1] option:nth-child(2)\"\r\n1. I am on page \"/admin/consultations/view/1\"\r\n\r\n\r\nFAILURES!\r\nTests: 4, Assertions: 1, Failures: 1.\r\n```\r\n\r\nNow, if I apply a selected value to the html form as:\r\n```\r\n<html>\r\n<body>\r\n    <form>\r\n        <select name=\"test1\" id=\"test\">\r\n            <option value=\"1\" selected=\"selected\">One</option>\r\n            <option value=\"2\">Two</option>\r\n            <option value=\"3\">Three</option>\r\n        </select>\r\n    </form>\r\n</body>\r\n</html>\r\n```\r\n\r\nI get \r\n```\r\nCouldn't see option is selected \"#test\",\"Two\":\r\nFailed asserting that two strings are equal.\r\n--- Expected\r\n+++ Actual\r\n@@ @@\r\n-'Two'\r\n+'One'\r\n\r\nScenario Steps:\r\n4. I see option is selected \"#test\",\"Two\"\r\n3. I select option \"#test\",\"Two\"\r\n2. I grab text from \"form select[name=test1] option:nth-child(2)\"\r\n1. I am on page \"/admin/consultations/view/1\"\r\n```\r\nSo I know it is seeing the select element correctly, it doesn't apply the new selection to it.\r\nClicking on the form before selecting does not change anything.\r\n\r\nI started by having the issue with a Laravel form, but wanted to test on a really simple html form first.\r\n\r\nIs there anything I am doing wrong?"},"comment":{"url":"https://api.github.com/repos/Codeception/Codeception/issues/comments/99337309","html_url":"https://github.com/Codeception/Codeception/issues/1901#issuecomment-99337309","issue_url":"https://api.github.com/repos/Codeception/Codeception/issues/1901","id":99337309,"user":{"login":"zbateson","id":8356974,"avatar_url":"https://avatars.githubusercontent.com/u/8356974?v=3","gravatar_id":"","url":"https://api.github.com/users/zbateson","html_url":"https://github.com/zbateson","followers_url":"https://api.github.com/users/zbateson/followers","following_url":"https://api.github.com/users/zbateson/following{/other_user}","gists_url":"https://api.github.com/users/zbateson/gists{/gist_id}","starred_url":"https://api.github.com/users/zbateson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zbateson/subscriptions","organizations_url":"https://api.github.com/users/zbateson/orgs","repos_url":"https://api.github.com/users/zbateson/repos","events_url":"https://api.github.com/users/zbateson/events{/privacy}","received_events_url":"https://api.github.com/users/zbateson/received_events","type":"User","site_admin":false},"created_at":"2015-05-06T06:12:36Z","updated_at":"2015-05-06T06:12:36Z","body":"Hi @jrm2k6,\n\nCould you repost your code using fillField/seeInField and the failure message you're getting?\n\n"}}