try below if it helps.
update in script: your_element, your_text and your_phone_id
where your_phone_id you can get with "adb devices".
your_element.get(0).click();
String[] cmd1 = new String[]{"adb", "-s", "your_phone_id", "shell", "input", "text", "your_text"};
ProcessBuilder pb = new ProcessBuilder(cmd1);
Process process = pb.start();
//print inputStream to console
final Scanner scanner_1 = new Scanner(process.getErrorStream());
Thread t1 = new Thread() {
public void run() {
while (scanner_1.hasNextLine())
System.out.println(scanner_1.nextLine());
}
};
t1.start();