I’m trying to completely automate my iOS tests that run on Java using pc, on a remote Appium node running on mac.
I want my test to prepare his environment, so I want to restart the Appium server programmatically for each test.
When I execute on my mac terminal “appium --port 9191” it works great.
When I execute the same command manually with PuTTy it also works great.
But when I run the command using Java ssh clients nothing happens!
I tried using sshj and JSch, both doesn’t work.
(I was able to execute everything else on the mac using those APIs)
I also tried executing “/usr/local/bin/appium --port 9191” and “/Applications/Appium.app/Contents/Resources/node_modules/appium/bin/appium.js --port 9191”, didn’t work…
In my experience, when you invoke an SSH call to a remote machine you are not actually using the same PATH you configured using PuTTy. I solved this a few weeks ago but it was tricky. I’ll take a look in my solution later today and I’ll post the findings.
Cheers, Pavel
Finally found the solution!
It appears the 127 not found error happened because of some dependency the Appium used and not the Appium itself.
Like Pavel said, they indeed did not use the same path.
The solution was to create a bash script containing:
Ha! Awesome! Just came to post here…
That’s very similar to what I’ve done.
Also, don’t forget to kill the Appium server once you’re done with the test.
I do it with “killall node” but there’s probably a more humane way to close it.
Cheers, Pavel
Directly after that I want to create an AndroidDriver, but I’m getting an error message that the connection is refused (from the remote server).
I think that’s happening because the session is closed and the client is disconnected ? I assume that Appium is killed on the remote server because the SSH connection is closed ? How can I keep Appium running although the SSH connection is closed ?
I figured out a pretty nice solution for folks that actually don’t run Appium on the same machine as the CI - using SSH and tmux. That works from code as well as from the CI, Bamboo in my case.