0

How to return values from autoit script to selenium?

I want to return string value from autoit to selenium

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

Thanks,

1
  • 2
    what you have tried so far? Commented Apr 17, 2015 at 8:33

1 Answer 1

2

Read the InputStream of the process:

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);
}

And then, method waitFor() will make the current thread to wait until the external program finishes and returns the exit value.

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

And in your AutoIT script, you have to probably write output to the console (please try):

ConsoleWrite("data")
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.