{"action":"opened","issue":{"url":"https://api.github.com/repos/appium/appium/issues/7415","repository_url":"https://api.github.com/repos/appium/appium","labels_url":"https://api.github.com/repos/appium/appium/issues/7415/labels{/name}","comments_url":"https://api.github.com/repos/appium/appium/issues/7415/comments","events_url":"https://api.github.com/repos/appium/appium/issues/7415/events","html_url":"https://github.com/appium/appium/issues/7415","id":193804470,"number":7415,"title":"problem finding children of an element by xpath in IOS","user":{"login":"rkavalap","id":80310,"avatar_url":"https://avatars.githubusercontent.com/u/80310?v=3","gravatar_id":"","url":"https://api.github.com/users/rkavalap","html_url":"https://github.com/rkavalap","followers_url":"https://api.github.com/users/rkavalap/followers","following_url":"https://api.github.com/users/rkavalap/following{/other_user}","gists_url":"https://api.github.com/users/rkavalap/gists{/gist_id}","starred_url":"https://api.github.com/users/rkavalap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rkavalap/subscriptions","organizations_url":"https://api.github.com/users/rkavalap/orgs","repos_url":"https://api.github.com/users/rkavalap/repos","events_url":"https://api.github.com/users/rkavalap/events{/privacy}","received_events_url":"https://api.github.com/users/rkavalap/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":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-12-06T15:38:24Z","updated_at":"2016-12-06T15:38:25Z","closed_at":null,"body":"@alizelzele commented on [Sun Aug 28 2016](https://github.com/appium/appium-ios-driver/issues/176)\n\nThere is a bug in `commands.findUIElementsByXpath` (find.js:166). When trying to find children of an element by xpath, `au.getElement(context).getTreeForXML()` returns indexPath relative to the parent (not full index path), so the next command that wants to get elements by their indexPath `au.getElementsByIndexPaths([\"/0/3\"])` will fail or will find the wrong element (because of wrong indexPath).\n\nThe problem here is the only info about the parent we have is  the id of parent element. is there any way to get indexPath of an element by id? this way we can calculate the full indexPath and make the method work correctly.\n\n\n---\n\n@alizelzele commented on [Mon Aug 29 2016](https://github.com/appium/appium-ios-driver/issues/176#issuecomment-243026705)\n\nsome console logs (cropped to make it easier to read).\n\n```\nau.mainApp().getTreeForXML();\n  ->\"UIANavigationBar\":{\"name\":\"Sample\", \"path\":\"/0/0/0\"}\n          > {\"UIAButton\":{\"name\":\"Tap\", \"path\":\"/0/0/0/3\"}\n\n\nau.getElementByIndexPath('/0/0/0');\n  -> returned [object UIANavigationBar] with the name \"Sample\" (id: 0).\n\n\nau.getElement('0').getTreeForXML()\n  ->\"path\":\"/0/0\"\n          >{\"UIAButton\":{\"name\":\"Tap\", \"path\":\"/0/3\"}\n\n\nau.getElementsByIndexPaths([\"/0/3\"]); => wrong IndexPath\n```\n\n\n"}}
{"actor":{"display_login":"rkavalap"}}