Start appium(V1.3.2 Appium desktop) server through code on windows

Hi All,
I’m facing the below exception with Appium-Desktop v1.3.2 (downloaded from appium.io), and trying to connect to appium server but not connecting to server. pls let me know the issue

in the latest version of Appium-Desktop do we need to provide main.js or appium.js file in the commandLineArgument. i tried both but still giving the error.

Starting appium server

Started appium server
Step-1
Step-2
Error: Cannot find module ‘electron’
at Function.Module._resolveFilename (module.js:538:15)
at Function.Module._load (module.js:468:25)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object.module.exports.Object.defineProperty.value (C:\Users\satheeshnukala\AppData\Local\Programs\appium-desktop\resources\app\webpack:\external “electron”:1:1)
at webpack_require (C:\Users\satheeshnukala\AppData\Local\Programs\appium-desktop\resources\app\webpack:\webpack\bootstrap dfa496e38cddd9338602:19:1)
at Object. (C:\Users\satheeshnukala\AppData\Local\Programs\appium-desktop\resources\app\webpack:\app\main\main.development.js:1:1)
at webpack_require (C:\Users\satheeshnukala\AppData\Local\Programs\appium-desktop\resources\app\webpack:\webpack\bootstrap dfa496e38cddd9338602:19:1)
at Object. (C:\Users\satheeshnukala\AppData\Local\Programs\appium-desktop\resources\app\main.js:50:19)
at webpack_require (C:\Users\satheeshnukala\AppData\Local\Programs\appium-desktop\resources\app\webpack:\webpack\bootstrap dfa496e38cddd9338602:19:1)
Exception in thread “main” org.openqa.selenium.WebDriverException: Connection refused: connect
Build info: version: ‘3.9.1’, revision: ‘63f7b50’, time: ‘2018-02-07T22:42:28.403Z’
System info: host: ‘10INLPC0BS59M’, ip: ‘10.216.42.151’, os.name: ‘Windows 10’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘1.8.0_144’
Driver info: driver.version: AndroidDriver
at io.appium.java_client.remote.AppiumCommandExecutor.lambda$2(AppiumCommandExecutor.java:141)
at java.util.Optional.orElseGet(Optional.java:267)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:140)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:219)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:142)
at io.appium.java_client.DefaultGenericMobileDriver.(DefaultGenericMobileDriver.java:38)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:84)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:94)
at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:77)
at AppiumPackage.AppiumServerJava.startServer(AppiumServerJava.java:62)
at AppiumPackage.AppiumServerJava.main(AppiumServerJava.java:110)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:75)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:359)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:381)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:237)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)
at org.openqa.selenium.remote.internal.ApacheHttpClient.fallBackExecute(ApacheHttpClient.java:151)
at org.openqa.selenium.remote.internal.ApacheHttpClient.execute(ApacheHttpClient.java:91)
at org.openqa.selenium.remote.internal.ApacheHttpClient.execute(ApacheHttpClient.java:69)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:101)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:138)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:129)
… 12 more

Try this —> http://aksahu.blogspot.in/2015/10/start-and-stop-appium-server.html

Thanks @Jeeva i’ve tried that way too earlier, but could not able to access the appium server.

This Appim code in the blog will work when I installed the appium through node or npm commands right? correct me if i’m wrong.

is there any way to make it work, pls let me know?

A great open source appium script recording tool, more than that, appium gives a lot of tools possible