Questions tagged [expectj]

It is a Java implementation of the Unix expect utility.

ExpectJ can be used for automating interaction with either a process (through stdin / stdout) or a telnet session. It is a Java implementation of the Unix expect utility.

As easy like:

// Create a new ExpectJ object with a timeout of 5s
ExpectJ expectinator = new ExpectJ(5);

// Fork the process
Spawn shell = expectinator.spawn("/bin/sh");

// Talk to it
shell.send("echo Chunder\n");
shell.expect("Chunder");
shell.send("exit\n");
shell.expectClose();

// Done!
18 questions
0
votes
1 answer

How to handle passwords prompts in expectj

I would like to send "su root" command via expectj (in fact it is jsch).It requests password. Is there a way to handle it in expectj ?
0
votes
1 answer

How to use ExpectJ in synchronized way (waiting for answer with unknown content ) ?

My Java application has to work like this: User select bash commands in GUI and press "send." Application return distinct and independent answers for each command (e.g. we could store them in different files). Commands each run interactively, not…
0
votes
1 answer

ExpectJ for Telnet

I want to use equivalent of Expect in Java. This is a simple code: public class TelnetJExpect { @Test public void telnetTest() { ExpectJ expectinator = new ExpectJ(5); try { Spawn shell =…
Vladimir
  • 630
  • 3
  • 12
  • 26
1
2