How to write test for webview - android app

Team - I have to write the tests for an android app . app contains a web view and inside i have a login page.
how do I get the xpath and locate the elements in order to write the tests. please help

package cueme;
import org.openqa.selenium.By;
//import org.openqa.selenium.By;
import org.openqa.selenium.remote.CapabilityType;

import org.openqa.selenium.remote.DesiredCapabilities;

import io.appium.java_client.android.AndroidDriver;

//import java.io.File;

import java.net.MalformedURLException;

import java.net.URL;

//import java.util.concurrent.TimeUnit;

public class CuemeTest {

private static AndroidDriver driver;

public static void main(String[] args) throws MalformedURLException, InterruptedException {

	
	// Create object of DesiredCapabilities class

	DesiredCapabilities capabilities = new DesiredCapabilities();

	// Optional

	capabilities.setCapability(CapabilityType.BROWSER_NAME, "");

	// Specify the device name (any name)

	capabilities.setCapability("deviceName", "My New Phone");

	// Platform version

	capabilities.setCapability("platformVersion", "4.4.1");

	// platform name

	capabilities.setCapability("platformName", "Android");

	// specify the application package that we copied from appium

	//capabilities.setCapability("appPackage", "io.selendroid.directory");
	capabilities.setCapability("appPackage", "com.openstream.cueme.services.workbench");

	// specify the application activity that we copied from appium

    //capabilities.setCapability("appActivity", "EmployeeDirectory");
	capabilities.setCapability("appActivity","com.openstream.mmi.gui.CuemeActivityDelegate");
	capabilities.setCapability("appActivity","com.openstream.cueme.services.screen.WBBrowserRenderer");

	// Start android driver, default it will be 4723

	driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
	//driver.switchTo().window("WEBVIEW");
	 //driver.findElement(By.tagName("input")).sendKeys("test");
	//driver.findElementByTagName("userId").sendKeys("sysadmin");
	//driver.findElementByTagName("CuemePassword").sendKeys("MMNext13#");
	
	// close the application
	Thread.sleep(20000);

	driver.quit();

}

}

Xpath you can find for example in Chrome: open page “chrome://inspect/” (device with opened webview should be connected to machine)
And then you can click (or other) on web elements with “driver.findElementBy…”

Hi I got it working now . Actually the web-view was not ready while executing the tests. when i put Thread.sleep(10000); it works fine .

driver.context(“WEBVIEW_com.openstream.cueme.services.workbench”);
Thread.sleep(10000);
driver.findElementById(“userId”).sendKeys(“sysadmin”);
driver.findElementById(“CuemePassword”).sendKeys(“MMNext13#”);
One clarification while automating the below scenario

i have two boxes the second one will display only after I select the value from first one .
I am able to select the value in first select and then second one displayed
but i am unable to select the value from the second, Please see below code

driver = new AndroidDriver(new URL(“http://127.0.0.1:4723/wd/hub”), capabilities);
driver.context(“WEBVIEW_com.openstream.cueme.services.workbench”);
Thread.sleep(10000);
//driver.findElementById(“userId”).sendKeys(“sysadmin”);
//driver.findElementById(“CuemePassword”).sendKeys(“MMNext13#”);
driver.findElementById(“authParam_Format”).sendKeys(“dc”); first - working
driver.findElementById(“authParam_DCDomain”).sendKeys(“wmsc”); second - not workiing