I have started using wdio recently, i was using the method below to switch between native and webcontext in java, how i can apply same method for wdio
protected boolean switchToWebContext() {
ArrayList<String> contexts = new ArrayList(driver.getContextHandles());
for (String context : contexts) {
if (context.contains("WEBVIEW")) {
driver.context(context);
return true;
}
}
return false;
}
protected boolean switchToNativeContext() {
ArrayList<String> contexts = new ArrayList(driver.getContextHandles());
for (String context : contexts) {
if (context.equals("NATIVE_APP")) {
driver.context(context);
return true;
}
}
return false;
}