2017-02-15 145 views
-1

登录Flie附上运行脚本Appium错误显示:一个新的会话无法创建

info: --> POST /wd/hub/session {"desiredCapabilities":{"appActivity":"com.google.android.launcher.GEL","appPackage":"com.google.android.googlequicksearchbox","platformName":"Android","deviceName":"","platformVersion":""}}

info: Client User-Agent string: Apache-HttpClient/4.5.1 (Java/1.8.0_77)

info: [debug] Didn't get app but did get Android package, will attempt to launch it on the device

info: [debug] Creating new appium session 13200b99-4982-4ed9-bed4-7dd89bc865dc info: Starting android appium info: [debug] Getting Java version info: Java version is: 1.8.0_77 info: [debug] Checking whether adb is present info: [debug] Using adb from

C:\用户\ SAMEER_PWS \应用程序数据\本地\ Android的\ SDK \平台TOOLS \ adb.exe

warn: No app capability, can't parse package/activity info: [debug] Using fast reset? true info: [debug] Preparing device for session info: [debug] Not checking whether app is present since we are assuming it's already on the device

info: Retrieving device info: [debug] Trying to find a connected android device info: [debug] Getting connected devices... info: [debug] executing cmd:

C:\用户\ SAMEER_PWS \应用程序数据\本地\ Android的\ SDK \平台TOOLS \ adb.exe设备

info: [debug] 1 device(s) connected info: Found device 0b01aa5a0298ee0e info: [debug] Setting device id to 0b01aa5a0298ee0e info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)

info: [debug] executing cmd: C:\Users\SAMEER_PWS\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0b01aa5a0298ee0e wait-for-device info: [debug] executing cmd: C:\Users\SAMEER_PWS\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0b01aa5a0298ee0e shell "echo 'ready'" info: [debug] Starting logcat capture info: [debug] Getting device API level info: [debug] executing cmd: C:\Users\SAMEER_PWS\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0b01aa5a0298ee0e shell "getprop ro.build.version.sdk" info: [debug] Device is at API Level 23 info: Device API level is: 23 info: [debug] Extracting strings for language: default info: [debug] Apk doesn't exist locally info: [debug] Could not get strings, but it looks like we had an old strings file anyway, so ignoring info: [debug] executing cmd: C:\Users\SAMEER_PWS\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0b01aa5a0298ee0e shell "rm -rf /data/local/tmp/strings.json" info: [debug] Not uninstalling app since server not started with --full-reset info: [debug] Skipping install since we launched with a package instead of an app path info: [debug] Forwarding system:4724 to device:4724 info: [debug] executing cmd: C:\Users\SAMEER_PWS\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0b01aa5a0298ee0e forward tcp:4724 tcp:4724 info: [debug] Pushing appium bootstrap to device... info: [debug] executing cmd: C:\Users\SAMEER_PWS\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0b01aa5a0298ee0e push "C:\Program Files (x86)\Appium\node_modules\appium\build\android_bootstrap\AppiumBootstrap.jar" /data/local/tmp/ info: [debug] Logcat terminated with code 0, signal null info: [debug] Stopping logcat capture info: [debug] Logcat already stopped info: [debug] Sent shutdown command, waiting for UiAutomator to stop... warn: UiAutomator did not shut down fast enough, calling it gone error: Failed to start an Appium session, err was: Error: Command failed: C:\Windows\system32\cmd.exe /s /c "C:\Users\SAMEER_PWS\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0b01aa5a0298ee0e push "C:\Program Files (x86)\Appium\node_modules\appium\build\android_bootstrap\AppiumBootstrap.jar" /data/local/tmp/"

info: [debug] Cleaning up android objects info: [debug] Cleaning up appium session info: [debug] Error: Command failed: C:\Windows\system32\cmd.exe /s /c "C:\Users\SAMEER_PWS\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0b01aa5a0298ee0e push "C:\Program Files (x86)\Appium\node_modules\appium\build\android_bootstrap\AppiumBootstrap.jar" /data/local/tmp/"

at ChildProcess.exithandler (child_process.js:751:12) 
at ChildProcess.emit (events.js:110:17) 
at maybeClose (child_process.js:1016:16) 
at Process.ChildProcess._handle.onexit (child_process.js:1088:5) 

info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created.

(原来的错误:命令faile d:C:\ Windows \ system32 \ cmd.exe/s/c \“C:\ Users \ SAMEER_PWS \ AppData \ Local \ Android \ sdk \ platform-tools \ adb.exe -s 0b01aa5a0298ee0e push \”C:\\ Program Files(x86)\\ Appium \\ node_modules \\ appium \\ build \\ android_bootstrap \\ AppiumBootstrap.jar \“/ data/local/tmp/\”\ n)“,”killed“:false,”code“ :1,“signal”:null,“cmd”:“C:\ Windows \ system32 \ cmd.exe/s/c \”C:\ Users \ SAMEER_PWS \ AppData \ Local \ Android \ sdk \ platform-tools \ adb .exe -s 0b01aa5a0298ee0e push \“C:\\ Program Files(x86)\\ Appium \\ node_modules \\ appium \\ build \\ android_bootstrap \\ AppiumBootstrap.jar \”/ data/local/tmp/\“”, “origValue”:“命令失败:C:\ Windows \ system32 \ cmd.exe/s/c \”C:\ Users \ SAMEER_PWS \ AppData \ Local \ Android \ sdk \ platform-tools \ adb.exe -s 0b01aa5a0298ee0e push \“C:\\ Program Files(x86)\\ Appium \\ node_modules \\ appium \\ build \\ android_bootstrap \\ AppiumBootstrap.jar \”/ data/local/tmp/\“\ n”},“sessionId” :null}

info: <-- POST /wd/hub/session 500 12924.220 ms - 1039

+0

DesiredCapabilities帽=新DesiredCapabilities(); caps.setCapability(MobileCapabilityType.PLATFORM_NAME,“Android”); caps.setCapability(MobileCapabilityType.PLATFORM_VERSION,“”); caps.setCapability(MobileCapabilityType.DEVICE_NAME,“”); caps.setCapability(“appActivity”,“com.google.android.launcher.GEL”); (“appPackage”,com.google.android.googlequicksearchbox“); URL url = new URL(”http://127.0.0.1:4723/wd/hub“); \t \t AndroidDriver driver1 = new AndroidDriver (URL,帽); \t \t driver1.findElement(By.name( “计算器”))点击(); – user3610612

回答

1

您需要的路径添加到您的.apk文件:

capabilities.setCapability("app", "path to apk"); 
+0

我们可以通过定义活动名称和包名称过于开放的应用程序! 问题是服务器未正常启动 因此对于分辨率我使用命令promopt adb kill-server adb start- server 重新启动服务器。然后它工作。 – user3610612

相关问题