Unable to click on link in gmail content through appium android testing

I want to do automatic email verification in android.But Unable to click on link in gmail content through appium android testing. How can i do this any alternate way?

driver.startActivity(“com.google.android.gm”,
“ConversationListActivityGmail”);
driver
.findElement(By.id(“com.google.android.gm:id/search”)).click();
WebElement element = driver.findElement(By
.id(“com.google.android.gm:id/search_actionbar_query_text”));
setTextInputValue(element, "[email protected]");

    WebElement searchList = driver.findElement(By
            .id("com.google.android.gm:id/search_overlay_suggestion_list"));
    List<WebElement> weekObjectSearchList = searchList.findElements(By
            .className("android.widget.LinearLayout"));
    sleep(3000);
    weekObjectSearchList.get(0).click();
    sleep(3000);
    WebElement list = driver.findElement(By
            .id("com.google.android.gm:id/conversation_list_view"));
    List<WebElement> weekObjectList = list.findElements(By
            .className("android.widget.FrameLayout"));
 weekObjectList.get(0).click();
    sleep(3000);
    Set<String> contextNames = driver.getContextHandles();
    for (String contextName : contextNames) {
        System.out.println(contextNames); //prints out something like NATIVE_APP
    }

It is not printing “WEBVIEW”

post screenshot of UIAutomatorviewer, also provide more details like code snippet.

It;s not printing webview because google app u r using in that webview debugger is not enabled so u r not allowed to work on webview elements…

as suggested in above comments just check if the element u want to click comes under native context using UIAutomatorviewer

I also suggest if u want to use gmail then open gmail.com in browser using appium and then perform this step as gmail is a third party app u cannot change anything in it’s build process so you can use appium automation on it as a hybrid app … But if you launch it as a webApp I hope you can interact with its elements …