{"action":"opened","issue":{"url":"https://api.github.com/repos/appium/appium/issues/9788","repository_url":"https://api.github.com/repos/appium/appium","labels_url":"https://api.github.com/repos/appium/appium/issues/9788/labels{/name}","comments_url":"https://api.github.com/repos/appium/appium/issues/9788/comments","events_url":"https://api.github.com/repos/appium/appium/issues/9788/events","html_url":"https://github.com/appium/appium/issues/9788","id":281732923,"number":9788,"title":"Unable to switch between tabs on iOS Safari using Appium","user":{"login":"Kannamaraj","id":16046649,"avatar_url":"https://avatars2.githubusercontent.com/u/16046649?v=4","gravatar_id":"","url":"https://api.github.com/users/Kannamaraj","html_url":"https://github.com/Kannamaraj","followers_url":"https://api.github.com/users/Kannamaraj/followers","following_url":"https://api.github.com/users/Kannamaraj/following{/other_user}","gists_url":"https://api.github.com/users/Kannamaraj/gists{/gist_id}","starred_url":"https://api.github.com/users/Kannamaraj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kannamaraj/subscriptions","organizations_url":"https://api.github.com/users/Kannamaraj/orgs","repos_url":"https://api.github.com/users/Kannamaraj/repos","events_url":"https://api.github.com/users/Kannamaraj/events{/privacy}","received_events_url":"https://api.github.com/users/Kannamaraj/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-12-13T12:31:32Z","updated_at":"2017-12-13T12:31:32Z","closed_at":null,"author_association":"NONE","body":"Appium Version: 1.7.0\r\nDevice : iPhone 8 (iOS 11)\r\n\r\nI am trying to run my Appium tests on real iOS device. However, I cannot figure how to switch between tabs on Safari. I open a page on Safari using Appium IOSDriver instance. I then click a link on the page that opens a new tab. Now I wish to close this tab or at least switch back to the original window.\r\n\r\nI have tried the following solutions but none of them seem to help:\r\n\r\n1.Perform touch action to open the tabs interface, did not manage to click the tabs option.\r\n```\r\nTouchAction ta = new TouchAction(driver);\r\nint h=driver.manage().window().getSize().getHeight();\r\nint w=driver.manage().window().getSize().getWidth();\r\nta.tap(h-50,w-50).perform();\r\n```\r\n\r\n\r\nTried switch back to original context, did not help\r\n```\r\nfor (String contextName : contextNames) {\r\n    if(!contextName.equals(original)) {\r\n        WebViewContext = contextName;\r\n        ((AppiumDriver) driver).context(WebViewContext); \r\n        Thread.sleep(4000);\r\n        driver.close(); \r\n    } \r\n} \r\n```\r\n\r\n\r\nTried Javascript, no success\r\n```\r\nSet<String> windows = driver.getWindowHandles();\r\nString currentHandle = driver.getWindowHandle();\r\n((JavascriptExecutor)driver).executeScript(\"window.open();\"); \r\nSet<String> newWindow = driver.getWindowHandles();\r\nnewWindow.removeAll(windows);\r\ndriver.switchTo().window(original); \r\n```\r\n\r\ndriver.close() throws method not implemented error\r\n"}}
{"actor":{"display_login":"Kannamaraj"}}