This site is in read only mode. Please continue to browse, but replying, likes, and other actions are disabled for now.
52 / 205
Feb 2015
25 days later

hi Praveen,

I am getting the same exceptions and not sure how to add this .plist file and a bit worried to follow this site(http://www.dowdandassociates.com/blog/content/howto-set-an-environment-variable-in-mac-os-x-launchd-plist/) since I never played with these path variables. Can you please explain the steps to make ANDROID_HOME path available for Eclipse IDE.

[36minfo[39m: Welcome to Appium v1.3.4 (REV c8c79a85fbd6870cd6fc3d66d038a115ebe22efe)
[36minfo[39m: Appium REST http interface listener started on 127.0.0.1:4723
[36minfo[39m: [debug] Non-default server args: {"address":"127.0.0.1","noReset":true}
[36minfo[39m: Console LogLevel: debug
[36minfo[39m: [37m-->[39m [37mPOST[39m [37m/wd/hub/session[39m [90m{"desiredCapabilities":{"appPackage":"com.rhythmnewmedia.videotestapp","appActivity":"com.rhythmnewmedia.videotestapp.VideoTestSelectActivity","platformVersion":"4.3","automationName":"Appium","platformName":"Android","device":"Android","deviceName":"840751cb"}}[39m
[36minfo[39m: Client User-Agent string: Apache-HttpClient/4.3.4 (java 1.5)
[36minfo[39m: [debug] The following desired capabilities were provided, but not recognized by appium. They will be passed on to any other services running on this server. : device
[36minfo[39m: [debug] Didn't get app but did get Android package, will attempt to launch it on the device
[36minfo[39m: [debug] Creating new appium session 418368c9-ffb9-4e5c-872e-dbab19e9581b
[36minfo[39m: Starting android appium
[36minfo[39m: [debug] Getting Java version
[36minfo[39m: Java version is: 1.8.0_25
[36minfo[39m: [debug] Using fast reset? false
[36minfo[39m: [debug] Preparing device for session
[36minfo[39m: [debug] Not checking whether app is present since we are assuming it's already on the device
[36minfo[39m: [debug] Checking whether adb is present
[33mwarn[39m: The ANDROID_HOME environment variable is not set to the Android SDK root directory path. ANDROID_HOME is required for compatibility with SDK 23+. Checking along PATH for adb.
[36minfo[39m: [debug] executing cmd: which adb
[36minfo[39m: [debug] Sent shutdown command, waiting for UiAutomator to stop...
[33mwarn[39m: UiAutomator did not shut down fast enough, calling it gone
[31merror[39m: Failed to start an Appium session, err was: Error: Could not find adb. Please set the ANDROID_HOME environment variable with the Android SDK root directory path.
[36minfo[39m: [debug] Cleaning up android objects
[36minfo[39m: [debug] Cleaning up appium session
[36minfo[39m: [debug] Error: Could not find adb. Please set the ANDROID_HOME environment variable with the Android SDK root directory path.
at null. (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-adb/lib/adb.js:118:12)
at ChildProcess.exithandler (child_process.js:662:7)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:766:16)
at Socket. (child_process.js:979:11)
at Socket.emit (events.js:95:17)
at Pipe.close (net.js:466:12)
[36minfo[39m: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Could not find adb. Please set the ANDROID_HOME environment variable with the Android SDK root directory path.)","origValue":"Could not find adb. Please set the ANDROID_HOME environment variable with the Android SDK root directory path."},"sessionId":null}
[36minfo[39m: [37m<-- POST /wd/hub/session [39m[31m500[39m[90m 7123.561 ms - 342[39m [90m[39m
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Could not find adb. Please set the ANDROID_HOME environment variable with the Android SDK root directory path.) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 7.28 seconds
Build info: version: '2.44.0', revision: '76d78cf', time: '2014-10-23 20:02:37'

Thanks,
Radha

this issue is fixed by setting up the ANDROID_HOME path globally.

I am trying to initiate Appium server through code in the Windows machine for Android. Same I have used mentioned in this forum.
Receiving below error , could you please assist me in this.

I have seen in the "Task Manager" "node.exe" process is listed. but seeing below error.

FAILED CONFIGURATION: @BeforeMethod testscriptInitialization
org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '2.44.0', revision: '76d78cf', time: '2014-10-23 20:03:00'
System info: host: 'CSCINDAE751814', ip: '10.31.24.67', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_71'
Driver info: driver.version: AndroidDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:593)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:180)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:126)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:153)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:109)
at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:39)
at app.Framework.CommonJARS.AppiumServerLib.fwSetDriverToAppiumServer(AppiumServerLib.java:91)
at app.Framework.CommonJARS.AppiumServerLib.fwGetAppInstallAndInitialize(AppiumServerLib.java:80)
at app.TestSuite.POCTestScripts.Mob_SignIn_ValidateForValidCustomer.testscriptInitialization(Mob_SignIn_ValidateForValidCustomer.java:59)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:564)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:653)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to 127.0.0.1:4788 [/127.0.0.1] failed: Connection refused: connect
at org.apache.http.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:140)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:318)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:363)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:219)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:86)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
at org.openqa.selenium.remote.HttpCommandExecutor.fallBackExecute(HttpCommandExecutor.java:215)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:184)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:572)
... 35 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:72)
at org.apache.http.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:123)
... 47 more

SKIPPED CONFIGURATION: @AfterMethod endTestScriptExecution
SKIPPED: Mob_SignIn_ValidateForValidCustomer_TestScript

===============================================
Default test
Tests run: 1, Failures: 0, Skips: 1
Configuration Failures: 1, Skips: 1
===============================================

===============================================
Default suite
Total tests run: 1, Failures: 0, Skips: 1
Configuration Failures: 1, Skips: 1
===============================================

[TestNG] Time taken by [FailedReporter passed=0 failed=0 skipped=0]: 13 ms
[TestNG] Time taken by org.testng.reporters.EmailableReporter2@181d405: 13 ms
[TestNG] Time taken by org.testng.reporters.JUnitReportReporter@107f8ba: 10 ms
[TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter@157457b: 170 ms
[TestNG] Time taken by org.testng.reporters.XMLReporter@19a8942: 11 ms
[TestNG] Time taken by org.testng.reporters.jq.Main@11e1813: 29 ms

Thanks for your support !!!

Regards,
Kiran

You successfully managed to start the Appium server programmatically as I can see (because the node.exe process exists in the Task Manager).

The problem seems to be with Appium server configurations or capabilities. Please provide both of them.

@Hassan_Radi: Thanks for response. In another way , manually started Appium server , executed script from setting server capabilities without any issues.

The issue is appearing only when Appium server and same Appium capabilities are running through code. However please see below code (values are driven from spreadsheet part of framework.

String strJ4uBuildFilePath = ReadGlobalConfiguration.globalConfigprop.getProperty("J4uApp_BuildFilePath");
String strJ4uBuildFile = ReadGlobalConfiguration.globalConfigprop.getProperty("J4uApp_Android_BuildFileName");
FwConstants.fwSetDesiredCapability();

     File appDir = new File(strJ4uBuildFilePath);
	 File app = new File(appDir,strJ4uBuildFile);

	 FwConstants.Appiumcapabiliy.setCapability("automationName", FwConstants.strArg_AutomationName_Val);
	 FwConstants.Appiumcapabiliy.setCapability("platformName",FwConstants.strArg_PlatformName_Val);
	 FwConstants.Appiumcapabiliy.setCapability("platformVersion",FwConstants.strArg_Arg_PlatformVersion_Val);
	 FwConstants.Appiumcapabiliy.setCapability("deviceName",FwConstants.strArg_DeviceName_Val);
	 FwConstants.Appiumcapabiliy.setCapability("app-package",FwConstants.strArg_Package_Val);
	 FwConstants.Appiumcapabiliy.setCapability("app-activity",FwConstants.strArg_Activity_Val);

	 FwConstants.Appiumcapabiliy.setCapability("app", app.getAbsolutePath());
	 fwSetDriverToAppiumServer();

below code is part of above method fwSetDriverToAppiumServer();

FwConstants.fwSetDesiredCapability();

	 try {
		 FwConstants.AndDriver = new AndroidDriver (new URL(FwConstants.strArg_URL),FwConstants.Appiumcapabiliy);
		} catch (MalformedURLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	 FwConstants.AndDriver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);

Please let me know if you need further information.

Regards,
Kiran

You forgot to attach your server configurations :smile: . Also please attach your Appium server log.

@Hassan_Radi: Thanks for requesting log.
After your hint i did check the log , found "deviceName" is missing listed in the log. Due to code error , appiumcapability object is setting hence it is not finding "deviceName" , I have fixed framework code and working fine (starting and stopping server through code). This is happening only when I execute the script in "Debug" mode. When I initiated the script as "Run" mode , it is not starting the server. I have checked the task manager , I didn't see "node.exe" process.
Please see below log details and I request guidance in this.

[TestNG] Running:
C:\Users\kedupuganti\AppData\Local\Temp\testng-eclipse--511367850\testng-customsuite.xml

FAILED CONFIGURATION: @BeforeMethod testscriptInitialization
org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '2.44.0', revision: '76d78cf', time: '2014-10-23 20:03:00'
System info: host: 'CSCINDAE751814', ip: '10.31.24.67', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_71'
Driver info: driver.version: AndroidDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:593)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:180)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:126)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:153)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:109)
at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:39)
at app.Framework.CommonLibs.AppiumServerLib.fwSetDriverToAppiumServer(AppiumServerLib.java:156)
at app.Framework.CommonLibs.AppiumServerLib.fwGetAppInstallAndInitialize(AppiumServerLib.java:120)
at app.TestSuite.POCTestScripts.Mob_SignIn_ValidateForValidCustomer.testscriptInitialization(Mob_SignIn_ValidateForValidCustomer.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:564)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:653)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to 127.0.0.1:4789 [/127.0.0.1] failed: Connection refused: connect
at org.apache.http.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:140)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:318)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:363)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:219)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:86)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
at org.openqa.selenium.remote.HttpCommandExecutor.fallBackExecute(HttpCommandExecutor.java:215)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:184)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:572)
... 35 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:72)
at org.apache.http.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:123)
... 47 more

SKIPPED CONFIGURATION: @AfterMethod endTestScriptExecution
SKIPPED: Mob_SignIn_ValidateForValidCustomer_TestScript

===============================================
Default test
Tests run: 1, Failures: 0, Skips: 1
Configuration Failures: 1, Skips: 1
===============================================

===============================================
Default suite
Total tests run: 1, Failures: 0, Skips: 1
Configuration Failures: 1, Skips: 1
===============================================

Can you please mention what are you doing in your script on line 156 in your "AppiumServerLib" file?? The exception seems to be initiated from there

@Hassan_Radi: line 156 set capabilities to driver

FwConstants.AndDriver = new AndroidDriver (new URL(FwConstants.strArg_URL),FwConstants.Appiumcapabiliy);

url is coming from excel spreadsheet , accessed using Apache POI.

****@Kamal_Girdher:**** Thanks for response and provided links , i built the framework which will access the values dynamically from the spreadsheet during execution. Firstly I am executing on Windows , same code I was referring into dynamic code. It is perfectly running in debug mode (node.exe invoke , setting capabilities and running above mentioned driver code). But during run mode , giving above mentioned error for which Hasan is requesting information. Thanks for your help.

The fact that it fails when starting the Appium session is because starting the server was somehow skipped and it is now trying to reach a server that was not started.

The server starting logic might have failed and was not started successfully without you noticing (It would throw an error message in the command prompt log) because the server might have been already running and trying to start it again with the same IP address and port number will give an error message saying that "The port number is already used by another application"

I recommend checking if the server is already running before you attempt to start it. If it was actually running, then you should stop it and then move to the start logic again. Also when working with the command prompt and executing actions in this manner, you should always print the output of the command execution in your log to be able to refer to that later and know what went wrong.

Hope I helped....

P.S. The IP address you are using "10.31.24.67" doesn't look like a local address on your machine, unless you are doing some loopback tunneling, so please check the IP address and make sure it is not the issue.

@Hassan_Radi:

Thanks for your time and comments.

I am examining and working on your comments.

I have two queries here:
a) How to know whether Appium server is running or not , do you have any reference code or link?
b) Regarding output of the command execution log record , do you have any link or reference code?, so that I will implement and see

The IP address shown in the log file is , Host IP Address. But in the actual code for server start on IP Address is 127.0.0.1 , port 4789

Does this impact when we trying to initiate Appium server through code?

Regards,
Kiran

You will find a node.exe process in your task manager when the server is running.

You can use this function74. The whole class is supposed to start and stop Appium server. Give it a try and let me know how it works.

8 days later

hi bro can you tell me how i can do this in c# please in mac platform...how can i start the server and also give my app path for the simulator to open the app.?

@Hassan_Radi: Thanks for your great support , while this is still under my work , I have another priority issue than this one. If you have time , could you please respond to below mentioned issue which I have to clear ASAP.

Regards,
Kiran

pinned Mar 13, '15

hey hi,
I am new to the appium i want to launch appium in ubuntu, want to know how to write test scripts..
any help would be very helpful.
thanks in advance.