Unable to find WEBVIEW context with iOS 13
See original GitHub issueThe problem
I am unable to find WEBVIEW context using driver.contexts. It only shows [‘NATIVE_APP’] using get_all_context. I have no problem getting and switching to WEBVIEW using Appium 1.13 with iOS 12.0. However, recently I want to upgrade to iOS 13 using the latest Appium. I keep running into this problem.
Environment
- Appium version: 1.17.1-beta.0
- Last Appium version that did not exhibit the issue: 1.13 + iOS 12.0
- Desktop OS/version used to run Appium: MacOS 10.15.4 / Xcode 11.4
- Node.js version: 13.12.0
- Npm or Yarn package manager: 6.14.4
- Mobile platform/version: iOS 13.0
- Real device or emulator/simulator: iOS Simulator
- Appium CLI or Appium.app|exe: Appium CLI
/usr/local/lib
└─┬ appium@1.17.1-beta.0
├─┬ appium-ios-driver@4.6.2
│ └── appium-remote-debugger@4.5.0
└─┬ appium-xcuitest-driver@3.21.1
└── appium-remote-debugger@8.9.0
Details
There is no issue with Appium 1.13 + iOS 12.0 switching webview in my app. I don’t know what I did wrong in this setup. I have already update everything to the latest version as I can. It seems like appium can not find any WEBVIEW at all, since I keeps getting only [NATIVE_APP]. I have tried:
- Uninstall and reinstall appium CLI both 1.17.1 and beta
- Add Capabilities like: ‘fullContextList’: True I am still unable to resolve this issue.
Link to Appium logs
GIST Link : https://gist.github.com/jerislee/54e9cf4fc7c944673b779b10b6de64dc Part of important log : https://gist.github.com/jerislee/82c6722b6e9157dbabcf0e43e6378107
Code To Reproduce Issue [ Good To Have ]
def switch_context(self, context): # context = 'WEBVIEW' / 'NATIVE_APP'
time.sleep(10)
self.logger.info("[Automation Log]: before switch " + self.driver.current_context)
while context not in self.driver.current_context:
if context == "WEBVIEW":
self.logger.info(self.driver.contexts)
try:
self.driver.switch_to.context(self.driver.contexts[1])
except BaseException as msg:
self.logger.info(msg)
elif context == "NATIVE_APP":
self.driver.switch_to.context(context)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:37 (18 by maintainers)
Top GitHub Comments
Still having issues with this. Here is a repro using Appium Desktop - Get All Contexts
ios 13.4 appium 1.17.1-1
Capabilities: { “app”: “app”, “platformName”: “iOS”, “platformVersion”: “13.4”, “deviceName”: “iPhone 11 Pro Max 13.4”, “automationName”: “XCUITest”, “webviewConnectTimeout”: “90000”, “safariLogAllCommunication”: true }
for(int i = 0; i<30; i++) { Thread.sleep(1000); Set<String> contextNames = driver.getContextHandles(); for (String contextName : contextNames) { System.out.println(contextName); //prints out something like NATIVE_APP \n WEBVIEW_1driver.quit(); } }
works for me.