Open an app on machine where Eggplant scripts are running

Is there a way to have Eggplant open an application on the Mac where the scripts are running?

For example, I want the script to open Terminal or Remote Desktop Connection, and then interact with it. I know I can open applications on the SUT, but can Eggplant open applications on the machine where the scripts are being executed?

Thanks.

Comments

  • EggplantMattEggplantMatt ForumAdmin admin
    You can use the "Open" command (see the SenseTalk Reference) to launch an application on the EggPlant machine, but you can't actually interact with it after it launches. You could have your script connect to a second user account on the same machine and run an application there that you would then interact with just as you would with any other SUT.
  • SenseTalkDougSenseTalkDoug ForumAdmin admin
    Of course, if you just want to run a script in the Terminal, you can achieve the same result directly in Eggplant using the shell command/function:
    put shell("ls ~")
    
    If you need to do more significant interaction, that can be done too, using the "open process" command to open a connection to a shell process, and then the "write to process" and "read from process" commands to interact with it. These commands are documented in the section on "File, Socket, Process, and Stream Input and Output" in the SenseTalk manual.

    For other programs you may be able to interact with them through AppleScript, if they support it. For example, Terminal is AppleScript-able so you can do something like this:
    do AppleScript {{
    tell application "Terminal"
    set foo to do script "ls ~" 
    delay 1
    history of foo
    end tell
    }}
    put the result
    
    Unfortunately, that seems to get all of the text that appears in the Terminal window, so you'll have to do some parsing to get just the output that you're interested in.
Sign In or Register to comment.