如何将值从autoit脚本返回到selenium

How to return values from autoit script to selenium

如何将值从autoit脚本返回到selenium?

我想将字符串值从autoit返回到selenium

1
2
String t = Runtime.getRuntime().exec("D:\\\\AutoItScipts\\\\downloadWindow.exe");
System.out.println(t);

谢谢,


读取进程的InputStream:

1
2
3
4
5
6
7
8
Process p = Runtime.getRuntime().exec("your autoIT exe file path");

BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));

String line;
while ((line = input.readLine()) != null) {
  System.out.println(line);
}

然后,方法waitFor()将使当前线程等待,直到外部程序完成并返回退出值。

1
2
int exitVal = p.waitFor();
System.out.println("Exited with error code"+exitVal);

在您的AutoIT脚本中,您可能必须将输出写入控制台(请尝试):

1
ConsoleWrite("data")