Hybrid app automation in iOS automation using appium

We can automate the hybrid app very easily using Appium. Hybrid app contains native control as well as web controls. You need to switch the context to web control within app and then we can use the normal Selenium webdriver API to perform the operations. To auto switch the context to web, you can pass below capability.
capabilities.SetCapability(“autoWebview”, true);

Otherwise you can use below code to find all contexts within app and switch to it.
System.out.println("Context count " + driver.getContextHandles().size());

for (Object contextName : driver.getContextHandles()) {
    System.out.println("Context Name -> " + contextName);
    if (contextName.toString().toUpperCase().contains("WEBVIEW")){
        System.out.println("Switched to WebView Context");

//Switch back to Native app

Web development and Automation testing

solutions delivered!!