1

I wrote a code that start Appium server and after I start some automation. This is the Appium Launch code: (in C#)

using System.Diagnostics;

System.Diagnostics.Process process;
process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Maximized; //Change to Hidden after debug
startInfo.FileName = AppiumNodePath;
startInfo.Arguments =   AppiumJSPath + " --address " + AppiumServerIP + " --port " + currentAppiumPort + " --automation-name Appium --log-no-color --session-override --log C:\\test\\AppiumLog.txt";
process.StartInfo = startInfo;
process.Start();

I want to wait for Appium Server to be ready and only then to start the automation, Because if you start creating driver before I get an exception that Appium port is busy/refused.

How can I check if Appium is up and ready?

Yuval Levy
  • 2,397
  • 10
  • 44
  • 73

2 Answers2

3

You can make a call to http://127.0.0.1:4723/wd/hub/sessions this will return all running sessions. You then get an xml response with the session information.

JaysonP
  • 164
  • 1
  • 10
  • what do you mean by "make a call"? – Yuval Levy Oct 18 '16 at 10:07
  • Refer to this link, you need to make an HTTP request to the link I described above: http://stackoverflow.com/questions/7688350/c-sharp-how-to-make-a-http-call – JaysonP Oct 18 '16 at 13:45
  • Thanks for your comment, when I try - GetResponse() I get "System.Net.WebException: The remote server returned an error: (404) Not Found" Exception. Do you know why? – Yuval Levy Oct 18 '16 at 16:13
  • I would need your appium logs to be able to diagnose. I would assume that you are on a different port or are using the `http://0.0.0.0:4723` URL – JaysonP Oct 18 '16 at 18:33
  • Also make sure you have the plural for the `/sessions` I believe if you forget the `s` at the end you will get a 404 – JaysonP Oct 18 '16 at 19:33
  • I will add here Appium Logs, where do you think that I have the "session" instead of "sessions" mistake? – Yuval Levy Oct 19 '16 at 08:55
-1

Run this command in the terminal:

appium &
minar09
  • 453
  • 6
  • 17