How to automatically start and advance a few steps in an application in background in linux?

StackOverflow https://stackoverflow.com/questions/19339872

  •  30-06-2022
  •  | 
  •  

Question

I'm using Genymotion to run WhatsApp on Ubuntu 13.04 as I don't own an Android.

To get to Whatsapp everytime I login, I have to

1) open terminal and run ~genymotion/genymotion

2) click a button on the GUI which opens up another new window (play button).

3) wait for about 30s for the device to get ready.

How can I make the computer do these first two steps automatically for me at start up?

Even better if it possible to do them in background, i.e., I shouldn't see the GUI opening. It should perform the steps and be "minimized".

I was thinking if there was a way to record what my click does and then put it in a script. Something like a strace command.

I hope my question is clear enough. I'm relatively new to Linux.

Was it helpful?

Solution

For now Genymotion allows you to start a VM from the command line, by calling the "player" binary, and passing the VM name as a parameter.

You could write a shell script that:

  • run: <GENYMOTION PATH>/player --vm-name <VM NAME>,
  • wait some seconds for the VM to boot: sleep 10,
  • then use adb to start your Application: adb shell am start -n com.whatsapp/com.whatsapp.Main

Luckily, no need to simulate clicks for this.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top