Search code examples
c#androidvisual-studioseleniumappium

what's wrong with appium launch that my program ended with timeout when trying to connect to appium server?


I'm new to appium. I'm working on windows 7, and followed the instructions here

I wrote a tiny program in C#(visual studio) that connects to appium server. however, the program ends with the failure message: 'the http request to the remote webdriver server for URLhttp://127.0.0.1:4723/wd/hub/session timed out. I don't get why it happens. I think I provide everything required. in any case, here's the log displayed on appium server:

2016-01-20 13:00:40:391 - info: Appium REST http interface listener started on 127.0.0.1:4723 2016-01-20 13:00:40:394 - info: [debug] Non-default server args: {"app":"C:\Users\User\Desktop\deskclock.apk","address":"127.0.0.1","logTimestamp":true,"logNoColors":true,"androidPackage":"com.google.android.deskclock","androidActivity":"com.android.deskclock.DeskClock","avd":"TestDevice","platformName":"Android","platformVersion":"23","automationName":"Appium"} 2016-01-20 13:00:40:395 - info: Console LogLevel: debug 2016-01-20 13:01:01:497 - info: --> POST /wd/hub/session {"desiredCapabilities":{"deviceName":"TestDevice","apppackage":"com.google.android.deskclock","platformName":"Android"}} 2016-01-20 13:01:01:499 - info: Client User-Agent string: undefined 2016-01-20 13:01:01:500 - info: [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. : apppackage 2016-01-20 13:01:01:502 - info: [debug] Using local app from command line: C:\Users\User\Desktop\deskclock.apk 2016-01-20 13:01:01:503 - info: [debug] Creating new appium session c67e396c-58c6-4c45-a4be-7561171b6a2b 2016-01-20 13:01:01:504 - info: Starting android appium 2016-01-20 13:01:01:505 - info: [debug] Getting Java version 2016-01-20 13:01:01:582 - info: Java version is: 1.7.0_45 2016-01-20 13:01:01:583 - info: [debug] Checking whether adb is present 2016-01-20 13:01:01:584 - info: [debug] Using adb from C:\Users\User\AppData\Local\Android\android-sdk\platform-tools\adb.exe 2016-01-20 13:01:01:584 - info: [debug] Using fast reset? true 2016-01-20 13:01:01:585 - info: [debug] Preparing device for session 2016-01-20 13:01:01:585 - info: [debug] Checking whether app is actually present 2016-01-20 13:01:01:585 - info: [debug] Trying to find TestDevice emulator 2016-01-20 13:01:01:585 - info: [debug] Getting connected emulators 2016-01-20 13:01:01:586 - info: [debug] Getting connected devices... 2016-01-20 13:01:01:587 - info: [debug] executing cmd: C:\Users\User\AppData\Local\Android\android-sdk\platform-tools\adb.exe devices 2016-01-20 13:01:01:613 - info: [debug] 2 device(s) connected 2016-01-20 13:01:01:614 - info: [debug] 2 emulator(s) connected 2016-01-20 13:01:01:614 - info: [debug] Sending telnet command to device: avd name 2016-01-20 13:01:01:614 - info: [debug] Getting running emulator port 2016-01-20 13:01:01:615 - info: [debug] Sending telnet command to device: avd name 2016-01-20 13:01:01:616 - info: [debug] Getting running emulator port 2016-01-20 13:01:01:618 - info: [debug] Socket connection to device created 2016-01-20 13:01:01:618 - info: [debug] Socket connection to device ready 2016-01-20 13:01:01:620 - info: [debug] Telnet command got response: TestDevice 2016-01-20 13:01:01:621 - info: [debug] Found emulator TestDevice in port 5554 2016-01-20 13:01:01:621 - info: [debug] Setting device id to emulator-5554 2016-01-20 13:01:01:621 - info: [debug] Did not launch AVD because it was already running. 2016-01-20 13:01:01:622 - info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5) 2016-01-20 13:01:01:623 - info: [debug] executing cmd: C:\Users\User\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s emulator-5554 wait-for-device 2016-01-20 13:01:01:652 - info: [debug] executing cmd: C:\Users\User\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s emulator-5554 shell "echo 'ready'" 2016-01-20 13:01:01:813 - info: [debug] Starting logcat capture 2016-01-20 13:01:02:074 - info: [debug] Getting device API level 2016-01-20 13:01:02:075 - info: [debug] executing cmd: C:\Users\User\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s emulator-5554 shell "getprop ro.build.version.sdk" 2016-01-20 13:01:02:467 - info: [debug] Device is at API Level 23 2016-01-20 13:01:02:468 - info: Device API level is: 23 2016-01-20 13:01:02:468 - info: [debug] Extracting strings for language: default 2016-01-20 13:01:02:469 - info: [debug] executing cmd: C:\Users\User\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s emulator-5554 shell "getprop persist.sys.language" 2016-01-20 13:01:02:615 - error: Unhandled error: Error: connect ECONNREFUSED at exports._errnoException (util.js:746:11) at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1012:19) context: [POST /wd/hub/session {"desiredCapabilities":{"deviceName":"TestDevice","apppackage":"com.google.android.deskclock","platformName":"Android"}}] 2016-01-20 13:01:02:982 - info: [debug] Current device persist.sys.language: 2016-01-20 13:01:02:983 - info: [debug] java -jar "C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\appium_apk_tools.jar" "stringsFromApk" "C:\Users\User\Desktop\deskclock.apk" "C:\Users\User\AppData\Local\Temp\com.google.android.deskclock" 2016-01-20 13:01:04:796 - info: [debug] Reading strings from converted strings.json 2016-01-20 13:01:04:797 - info: [debug] Setting language to default 2016-01-20 13:01:04:797 - info: [debug] executing cmd: C:\Users\User\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s emulator-5554 push "C:\Users\User\AppData\Local\Temp\com.google.android.deskclock\strings.json" /data/local/tmp 2016-01-20 13:01:04:855 - info: [debug] Checking whether aapt is present 2016-01-20 13:01:04:856 - info: [debug] Using aapt from C:\Users\User\AppData\Local\Android\android-sdk\build-tools\23.0.2\aapt.exe 2016-01-20 13:01:04:856 - info: [debug] Retrieving process from manifest. 2016-01-20 13:01:04:857 - info: [debug] executing cmd: C:\Users\User\AppData\Local\Android\android-sdk\build-tools\23.0.2\aapt.exe dump xmltree C:\Users\User\Desktop\deskclock.apk AndroidManifest.xml 2016-01-20 13:01:04:896 - info: [debug] Set app process to: com.google.android.deskclock 2016-01-20 13:01:04:896 - info: [debug] Not uninstalling app since server not started with --full-reset 2016-01-20 13:01:04:897 - info: [debug] Checking app cert for C:\Users\User\Desktop\deskclock.apk. 2016-01-20 13:01:04:897 - info: [debug] executing cmd: java -jar "C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\verify.jar" C:\Users\User\Desktop\deskclock.apk 2016-01-20 13:01:05:164 - info: [debug] App already signed. 2016-01-20 13:01:05:164 - info: [debug] Zip-aligning C:\Users\User\Desktop\deskclock.apk 2016-01-20 13:01:05:164 - info: [debug] Checking whether zipalign is present 2016-01-20 13:01:05:165 - info: [debug] Using zipalign from C:\Users\User\AppData\Local\Android\android-sdk\build-tools\23.0.2\zipalign.exe 2016-01-20 13:01:05:166 - info: [debug] Zip-aligning apk. 2016-01-20 13:01:05:167 - info: [debug] executing cmd: C:\Users\User\AppData\Local\Android\android-sdk\build-tools\23.0.2\zipalign.exe -f 4 C:\Users\User\Desktop\deskclock.apk C:\Users\User\AppData\Local\Temp\116020-9204-xzuy8n\appium.tmp 2016-01-20 13:01:05:230 - info: [debug] MD5 for app is 1ecaef182f19717b64e1f5caac138b85 2016-01-20 13:01:05:230 - info: [debug] executing cmd: C:\Users\User\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s emulator-5554 shell "ls /data/local/tmp/1ecaef182f19717b64e1f5caac138b85.apk" 2016-01-20 13:01:05:631 - info: [debug] Getting install status for com.google.android.deskclock 2016-01-20 13:01:05:631 - info: [debug] Getting device API level 2016-01-20 13:01:05:631 - info: [debug] executing cmd: C:\Users\User\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s emulator-5554 shell "getprop ro.build.version.sdk" 2016-01-20 13:01:05:962 - info: [debug] Device is at API Level 23 2016-01-20 13:01:05:963 - info: [debug] executing cmd: C:\Users\User\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s emulator-5554 shell "pm list packages -3 com.google.android.deskclock" 2016-01-20 13:01:12:464 - info: [debug] App is not installed 2016-01-20 13:01:12:464 - info: Installing App 2016-01-20 13:01:12:465 - info: [debug] executing cmd: C:\Users\User\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s emulator-5554 shell "mkdir -p /data/local/tmp/" 2016-01-20 13:01:12:777 - info: [debug] Removing any old apks 2016-01-20 13:01:12:777 - info: [debug] executing cmd: C:\Users\User\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s emulator-5554 shell "ls /data/local/tmp/*.apk" 2016-01-20 13:01:13:088 - info: [debug] Found an apk we want to keep at /data/local/tmp/1ecaef182f19717b64e1f5caac138b85.apk 2016-01-20 13:01:13:089 - info: [debug] Couldn't find any apks to remove 2016-01-20 13:01:13:089 - info: [debug] Uninstalling com.google.android.deskclock 2016-01-20 13:01:13:089 - info: [debug] executing cmd: C:\Users\User\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s emulator-5554 shell "am force-stop com.google.android.deskclock" 2016-01-20 13:01:18:439 - info: [debug] executing cmd: C:\Users\User\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s emulator-5554 uninstall com.google.android.deskclock 2016-01-20 13:01:24:088 - info: [debug] App was not uninstalled, maybe it wasn't on device? 2016-01-20 13:01:24:088 - info: [debug] executing cmd: C:\Users\User\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s emulator-5554 shell "pm install -r /data/local/tmp/1ecaef182f19717b64e1f5caac138b85.apk" 2016-01-20 13:04:31:462 - info: <-- POST /wd/hub/session - - ms - - undefined

In my settings I selected: application path package launch avd.

Is there anything else I had to select?


Solution

  • Try to change the port no in appium sever(from 4723 to 4729 etc) and in your code and use it enter image description here