Sampe Code:
Set contextName = driver.getContextHandles();
System.out.println(contextName);
for (String contexts : contextName) {
System.out.println(contexts);
if (contextName.contains(“NATIVE_APP”)) {
System.out.println(“Show me:” + contextName);
Thread.sleep(1500);
driver.context(“NATIVE_APP”);
driver.findElement(By.xpath(“Element Xpath”)).click();
}
if (contextName.contains(“WEBVIEW”)) {
driver.context(“WEBVIEW”);// Here get page source and search respective element
driver.findElement(By.xpath(" Element Xpath")).click();
}