Hey there.
I am attempting to launch Appium on a real device with my c# code.
Now, I can launch Appium succesfully on an Emulator but for some reason, launching on a device elludes me…
I am sending this command to initiate Appium:
start /Applications/Appium.app/Contents/Resources/node_modules/appium/bin/appium.js --address 0.0.0.0 --port 4723 --log-level debug --default-device --platform-name iOS --platform-version \"8.1\" --app \"/PathToMyApp.app\" --udidMyUDID -l --log /Users/pavelzagalsky/Library/Logs/Appium/6.log"
Right after that I declare my desiredCapabilities:
desiredCapabilities = DesiredCapabilities.IPhone();
desiredCapabilities.SetCapability("browserName", "iOS");
desiredCapabilities.SetCapability("platformVersion", "8.1");
desiredCapabilities.SetCapability("udid", "MyUDID");
desiredCapabilities.SetCapability("platformName", "iOS");
desiredCapabilities.SetCapability("deviceName", "iPhone 6");
desiredCapabilities.SetCapability("app", MobileVariables.IOS_APP_PATH);
driver = new IOSDriver(new Uri("http://" + MobileVariables.PAVEL_MAC + ":4723/wd/hub"), desiredCapabilities, new TimeSpan(0, 2, 30));
After running, I get this error message:
Unexpected error. System.Net.WebException: Unable to connect to the remote server —> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it xxx.xxx.xxx.xxx:4723
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
— End of inner exception stack trace —
at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)
at System.Net.HttpWebRequest.GetRequestStream()
at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute) in c:\Projects\webdriver\dotnet\src\webdriver\Remote\HttpCommandExecutor.cs:line 109
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters) in c:\Projects\webdriver\dotnet\src\webdriver\Remote\RemoteWebDriver.cs:line 910
Not sure what am I doing wrong here. Launching the Appium using the Appium app works flawlessly…
Thanks in advance, Pavel