How to start Appium programmaticaly with ICommandServer and AppiumLocalService in C#

Hello,

I previously used Appium with Java and starting and stopping appium server remotely was not a problem.

In C# i`m having difficulty using the new methods available (v1.5.0.1) for ICommandServer and AppiumLocalService in C#. I can only get it to start and stop appium on the local machine, not the remote Mac i want it to.

Did anyone use them, can you please give some info on how can i Start my APPIUM SERVER on a remote Mac?

Thanks,
–Gery–

Hi Gery,

You can try the following to start Appium Server pragmatically in C#.

System.Diagnostics.Process process = new System.Diagnostics.Process(); System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(); startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; startInfo.FileName = "C:/Program Files (x86)/Appium/node.exe"; startInfo.Arguments = @"""C:/Program Files (x86)/Appium/node_modules/appium/bin/appium.js"" --address 127.0.0.1 --port 4723 --automation-name Appium --log-no-color"; process.StartInfo = startInfo; process.Start(); appium_started = true;

Regards,
@Abdul_Sathar_Beigh

Hello @Abdul_Sathar_Beigh,

Thank you for the reply, your solution works locally if i run tests on the same PC i do the code, but i am planning to run the tests on a Mac so i can do cross-platform testing (only i cannot test ios on Windows), and the above code is not working for that purpose.

So to sum it up, i run the code from Windows PC, and the Mac will start the appium and will have the devices connected.

Thank you again,
–Gery–

Hi Gery

In that case what you need to do is:- In the same code, just provide Mac path for node.exe and appium.js and also provide the MAC IP address instead of 127.0.0.1.

Hope this resolves your issue.

Regards,
@Abdul_Sathar_Beigh