Previous version (1.15.1) I was able to perform this code.
Set<String> contextNames = driver.getContextHandles();
for (String contextName : contextNames) {
System.out.println(contextName); //prints out something like NATIVE_APP \n WEBVIEW_1
}
driver.context((String) contextNames.toArray()[1]); // set context to WEBVIEW_1
However after updated to the latest version (1.17.1), it encountered this error.
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1
at com.sapphire.appclient.automation.page.AbstractPage.getContext(AbstractPage.java:53)
...
...