{"action":"closed","issue":{"url":"https://api.github.com/repos/appium/appium/issues/8203","repository_url":"https://api.github.com/repos/appium/appium","labels_url":"https://api.github.com/repos/appium/appium/issues/8203/labels{/name}","comments_url":"https://api.github.com/repos/appium/appium/issues/8203/comments","events_url":"https://api.github.com/repos/appium/appium/issues/8203/events","html_url":"https://github.com/appium/appium/issues/8203","id":220563946,"number":8203,"title":"Unable to set focus on Text Box in iOS Real Device with Appium 1.6.4-beta version","user":{"login":"Elangopalakrishnan","id":26897289,"avatar_url":"https://avatars0.githubusercontent.com/u/26897289?v=3","gravatar_id":"","url":"https://api.github.com/users/Elangopalakrishnan","html_url":"https://github.com/Elangopalakrishnan","followers_url":"https://api.github.com/users/Elangopalakrishnan/followers","following_url":"https://api.github.com/users/Elangopalakrishnan/following{/other_user}","gists_url":"https://api.github.com/users/Elangopalakrishnan/gists{/gist_id}","starred_url":"https://api.github.com/users/Elangopalakrishnan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Elangopalakrishnan/subscriptions","organizations_url":"https://api.github.com/users/Elangopalakrishnan/orgs","repos_url":"https://api.github.com/users/Elangopalakrishnan/repos","events_url":"https://api.github.com/users/Elangopalakrishnan/events{/privacy}","received_events_url":"https://api.github.com/users/Elangopalakrishnan/received_events","type":"User","site_admin":false},"labels":[{"id":143265062,"url":"https://api.github.com/repos/appium/appium/labels/NeedsTriage","name":"NeedsTriage","color":"ededed","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":15,"created_at":"2017-04-10T07:52:31Z","updated_at":"2017-04-25T07:53:46Z","closed_at":"2017-04-25T07:53:46Z","body":"The Problem:\r\nI need to set focus the textbox and when i focus the text box It will open a keyboard.\r\n\r\nGetting following error when trying to enter the value to textbox by using the below code:\r\nAppDriver.Keyboard.SendKeys(\"1\");\r\n\r\nError:\r\n\r\nOneTimeSetUp: OpenQA.Selenium.WebDriverException : Unexpected error. Error Domain=com.facebook.WebDriverAgent Code=1 \"Keyboard is not present\" UserInfo={NSLocalizedDescription=Keyboard is not present}\r\n\r\nSo tired to focus the textbox, So if we focus the textbox, iOS will open a keyboard.\r\nThen we can use the sendkyes to enter the value.\r\n\r\nEnvironment:\r\nAppium v1.6.4-beta\r\nDesktop OS/version used to run Appium - OS 10.11.6\r\nMobile platform/version under test: iOS 10.2.1\r\nReal device\r\nAppium with C# code.\r\nVisual Studio codedUI Framework.\r\n\r\nDetails:\r\n\r\nI'm using appium with c# code.\r\nTesting the web application on Safari browser in iOS Device, I need to enter the value and tap somewhere in the screen. (like entering the product quantity and touch somewhere in screen, then it will add into shopping cart).\r\n\r\nI tried below code:\r\nwebDriver.FindElement(By.XPath(\"//input[@id='ProductDetails_QuantityTxt_3']\")).SendKeys(\"1\");\r\nTouchAction tp = new TouchAction(AppDriver);\r\ntp.Tap(100, 200, 3);\r\nHere i can't hit tap event in iOS screen.\r\nIt doesn't work in c#.\r\n\r\nI tried to set focus on text box by using Action class:\r\nwebElement = webDriver.FindElement(By.XPath(\"//input[@id='ProductDetails_QuantityTxt_3']\"));\r\nActions act = new Actions(AppDriver);\r\nact.MoveToElement(webElement).Click().Build().Perform();\r\nExxception: This method not implemented in c#.\r\n\r\nI tried to set focus by using java script:\r\nIJavaScriptExecutor js = (IJavaScriptExecutor).AppDriver;\r\njs.ExecuteScript(\"return document.getElementById('ProductDetails_QuantityTxt_4').focus()\");\r\nBut it doesn't focus the textbox in iOS Device safari browser, works fine in mac book safari browser.\r\n\r\nI tried to open a keyboard by using this code also, got from [(2866](https://github.com/appium/appium/issues/2866) issue)\r\nwebElement = AppDriver.FindElement(By.XPath(\"//input[@id='ProductDetails_QuantityTxt_4']\"));\r\nIJavaScriptExecutor js = (IJavaScriptExecutor)AppDriver;\r\njs.ExecuteScript(\"target.frontMostApp().keyboard().typeString('2')\", webElement);\r\nBut i got Exception: [in C#]\r\n[An unknown server-side error occurred while processing the command. Original error: Error while executing atom: Can't find variable: target (status: 13)]\r\n\r\nText box got focused when i tap the textbox manualy. and iOS open up a keyboard.\r\nEntering the value:\r\nAppDriver.Keyboard.SendKeys(\"1\");\r\nHiding the keyboard:\r\nIJavaScriptExecutor js = (IJavaScriptExecutor)AppDriver;\r\njs.ExecuteScript(\"return document.getElementById('ProductDetails_QuantityTxt_4').blur()\")\r\n\r\nPlease help me to open a keyboard in iOS Device or set focus on textbox in iOS Real Device.\r\n\r\nThanks in advance!"}}
{"actor":{"display_login":"Elangopalakrishnan"}}