What are the necessary changes to be done for iOS source code to see the "Webview" enabled in Hybrid App.
See original GitHub issueThe problem
Detecting the WEBVIEW context in iOS hybrid app. IOSDRIVER class provides only NATIVE context and not WEBVIEW context
Environment
- Appium version (or git revision) that exhibits the issue: 1.6.4
- Desktop OS/version used to run Appium: MAC Captian 10.11.6
- Mobile platform/version under test: iPhone 9.2.3
- Real device or emulator/simulator: Real device
- Appium CLI or Appium.app|exe: 1.0.0
Details
When i try to print the getcontext from IOSDriver class, the Webview context is not been returned by this class. Only “NATIVEVIEW” is printed. If same is followed in Android build i see WebVIEW and NATIVE been returned by respective driver class.
Do i need to make any changes to iOS source code before i generate an IPA file? Please help.
The code i am using to get or switch context is:
// Switching to iOS webview
IOSDriver<MobileElement> iosDriver = (IOSDriver<MobileElement>) appiumDriver;
Set<String> contextNames = iosDriver.getContextHandles();
for (String contextName : contextNames) {
System.out.println(contextName); //prints out something like [NATIVE_APP, WEBVIEW_<APP_PKG_NAME>]
if(contextName.contains("WEBVIEW")){
iosDriver.context(contextName);
System.out.println("Switched to: "+contextName);
break;
}
}
return iosDriver;
Issue Analytics
- State:
- Created 6 years ago
- Comments:13 (2 by maintainers)
Top Results From Across the Web
Automating Hybrid Apps - Appium
Automating hybrid apps; Entering the web view context ... One of the core principles of Appium is that you shouldn't have to change...
Read more >WKWebView | Apple Developer Documentation
A WKWebView object is a platform-native view that you use to incorporate web content seamlessly into your app's UI. A web view supports...
Read more >JavaScript Manipulation on iOS Using WebKit | Capital One
The new framework dramatically improved both the performance and flexibility of adding web content into iOS apps, giving developers more control and more...
Read more >iOS WebViews - HackTricks
WebViews are in-app browser components for displaying interactive web content. They can be used to embed web content directly into an app's user...
Read more >Mobile Apps: Native, Hybrid, and WebViews - UXmatters
Quora is a WebView app of some sort, with a few clearly native components along the edges. As you can see in Figure...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I added one Capability and then it worked. capabilities.setCapability(“instrumentApp”, “true”); 👍
Thanks.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.