请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

A new session could not be created.

Checking if an update is available
Update not available
Launching Appium server with command: C:\Program Files (x86)\Appium\node.exe lib\server\main.js --address 127.0.0.1 --port 4723 --platform-name Android --platform-version 23 --automation-name Appium --device-name “LP039888A6380004097” --log-no-color
info: Welcome to Appium v1.4.16 (REV ae6877eff263066b26328d457bd285c0cc62430d)
info: Appium REST http interface listener started on 127.0.0.1:4723
info: [debug] Non-default server args: {“address”:“127.0.0.1”,“logNoColors”:true,“deviceName”:“LP039888A6380004097”,“platformName”:“Android”,“platformVersion”:“23”,“automationName”:“Appium”}
info: Console LogLevel: debug
info: --> POST /wd/hub/session {“capabilities”:{“alwaysMatch”:{“platformName”:“Android”},“firstMatch”:[{}]},“desiredCapabilities”:{“deviceName”:“LP039888A6380004097”,“unicodeKeyboard”:“True”,“resetKeyboard”:“True”,“platformVersion”:“6.0”,“appPackage”:“com.teaui.starcalendar”,“platformName”:“Android”,“appActivity”:“com.teaui.calendar.module.MainActivity”}}
info: Client User-Agent string: selenium/3.141.0 (python windows)
warn: Converting cap unicodeKeyboard from string to boolean. This might cause unexpected behavior.
warn: Converting cap resetKeyboard from string to boolean. This might cause unexpected behavior.
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 52fde9a4-dff6-42d5-87a5-97ce1df2ba31
info: Starting android appium
info: [debug] Getting Java version
info: Java version is: 1.6.0_45
info: [debug] Checking whether adb is present
info: [debug] Using adb from E:\app\android-sdk_r24.3.4-windows\android-sdk-windows\platform-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: E:\app\android-sdk_r24.3.4-windows\android-sdk-windows\platform-tools\adb.exe devices
info: [debug] 1 device(s) connected
info: Found device LP039888A6380004097
info: [debug] Setting device id to LP039888A6380004097
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: E:\app\android-sdk_r24.3.4-windows\android-sdk-windows\platform-tools\adb.exe -s LP039888A6380004097 wait-for-device
info: [debug] executing cmd: E:\app\android-sdk_r24.3.4-windows\android-sdk-windows\platform-tools\adb.exe -s LP039888A6380004097 shell "echo ‘ready’"
info: [debug] Starting logcat capture
info: [debug] Getting device API level
info: [debug] executing cmd: E:\app\android-sdk_r24.3.4-windows\android-sdk-windows\platform-tools\adb.exe -s LP039888A6380004097 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: E:\app\android-sdk_r24.3.4-windows\android-sdk-windows\platform-tools\adb.exe -s LP039888A6380004097 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: E:\app\android-sdk_r24.3.4-windows\android-sdk-windows\platform-tools\adb.exe -s LP039888A6380004097 forward tcp:4724 tcp:4724
info: [debug] Pushing appium bootstrap to device…
info: [debug] executing cmd: E:\app\android-sdk_r24.3.4-windows\android-sdk-windows\platform-tools\adb.exe -s LP039888A6380004097 push “C:\Program Files (x86)\Appium\node_modules\appium\build\android_bootstrap\AppiumBootstrap.jar” /data/local/tmp/
info: [debug] Enabling Unicode keyboard support
info: [debug] Pushing unicode ime to device…
info: [debug] executing cmd: E:\app\android-sdk_r24.3.4-windows\android-sdk-windows\platform-tools\adb.exe -s LP039888A6380004097 install "C:\Program Files (x86)\Appium\node_modules\appium\build\unicode_ime_apk\UnicodeIME-debug.apk"
info: [debug] executing cmd: E:\app\android-sdk_r24.3.4-windows\android-sdk-windows\platform-tools\adb.exe -s LP039888A6380004097 shell "settings get secure default_input_method"
info: [debug] Unsetting IME 'com.sohu.inputmethod.sogou.leshi/.SogouIME’
info: [debug] Setting IME to 'io.appium.android.ime/.UnicodeIME’
info: [debug] executing cmd: E:\app\android-sdk_r24.3.4-windows\android-sdk-windows\platform-tools\adb.exe -s LP039888A6380004097 shell "ime enable io.appium.android.ime/.UnicodeIME"
info: [debug] executing cmd: E:\app\android-sdk_r24.3.4-windows\android-sdk-windows\platform-tools\adb.exe -s LP039888A6380004097 shell "ime set io.appium.android.ime/.UnicodeIME"
info: [debug] Pushing settings apk to device…
info: [debug] executing cmd: E:\app\android-sdk_r24.3.4-windows\android-sdk-windows\platform-tools\adb.exe -s LP039888A6380004097 install "C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk"
info: [debug] Pushing unlock helper app to device…
info: [debug] executing cmd: E:\app\android-sdk_r24.3.4-windows\android-sdk-windows\platform-tools\adb.exe -s LP039888A6380004097 install "C:\Program Files (x86)\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk"
info: Starting App
info: [debug] Attempting to kill all ‘uiautomator’ processes
info: [debug] Getting all processes with 'uiautomator’
info: [debug] executing cmd: E:\app\android-sdk_r24.3.4-windows\android-sdk-windows\platform-tools\adb.exe -s LP039888A6380004097 shell "ps ‘uiautomator’“
info: [debug] No matching processes found
info: [debug] Running bootstrap
info: [debug] spawning: E:\app\android-sdk_r24.3.4-windows\android-sdk-windows\platform-tools\adb.exe -s LP039888A6380004097 shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap -e pkg com.teaui.starcalendar -e disableAndroidWatchers false
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [debug] [UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap:
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 1
info: [debug] [BOOTSTRAP] [debug] Socket opened on port 4724
info: [debug] [BOOTSTRAP] [debug] Appium Socket Server Ready
info: [debug] [BOOTSTRAP] [debug] Loading json…
info: [debug] [BOOTSTRAP] [debug] Registered crash watchers.
info: [debug] Waking up device if it’s not alive
info: [debug] Pushing command to appium work queue: [“wake”,{}]
info: [debug] [BOOTSTRAP] [debug] Client connected
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“wake”,“params”:{}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: wake
info: [debug] [BOOTSTRAP] [debug] Returning result: {“status”:0,“value”:true}
info: [debug] executing cmd: E:\app\android-sdk_r24.3.4-windows\android-sdk-windows\platform-tools\adb.exe -s LP039888A6380004097 shell “dumpsys window"
info: [debug] Screen already unlocked, continuing.
info: [debug] Pushing command to appium work queue: [“getDataDir”,{}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“getDataDir”,“params”:{}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: getDataDir
info: [debug] [BOOTSTRAP] [debug] Returning result: {“status”:0,“value”:”/data”}
info: [debug] dataDir set to: /data
info: [debug] Pushing command to appium work queue: [“compressedLayoutHierarchy”,{“compressLayout”:false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“compressedLayoutHierarchy”,“params”:{“compressLayout”:false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: compressedLayoutHierarchy
info: [debug] [BOOTSTRAP] [debug] Returning result: {“status”:0,“value”:false}
info: [debug] Getting device API level
info: [debug] executing cmd: E:\app\android-sdk_r24.3.4-windows\android-sdk-windows\platform-tools\adb.exe -s LP039888A6380004097 shell "getprop ro.build.version.sdk"
info: [debug] Device is at API Level 23
info: [debug] executing cmd: E:\app\android-sdk_r24.3.4-windows\android-sdk-windows\platform-tools\adb.exe -s LP039888A6380004097 shell "am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n com.teaui.starcalendar/com.teaui.calendar.module.MainActivity"
info: [debug] Waiting for pkg “com.teaui.starcalendar” and activity “com.teaui.calendar.module.MainActivity” to be focused
info: [debug] Getting focused package and activity
info: [debug] executing cmd: E:\app\android-sdk_r24.3.4-windows\android-sdk-windows\platform-tools\adb.exe -s LP039888A6380004097 shell "dumpsys window windows"
info: [debug] Getting focused package and activity
info: [debug] executing cmd: E:\app\android-sdk_r24.3.4-windows\android-sdk-windows\platform-tools\adb.exe -s LP039888A6380004097 shell "dumpsys window windows"
info: [debug] Getting focused package and activity
info: [debug] executing cmd: E:\app\android-sdk_r24.3.4-windows\android-sdk-windows\platform-tools\adb.exe -s LP039888A6380004097 shell "dumpsys window windows"
info: [debug] Getting focused package and activity
info: [debug] executing cmd: E:\app\android-sdk_r24.3.4-windows\android-sdk-windows\platform-tools\adb.exe -s LP039888A6380004097 shell "dumpsys window windows"
info: [debug] Getting focused package and activity
info: [debug] executing cmd: E:\app\android-sdk_r24.3.4-windows\android-sdk-windows\platform-tools\adb.exe -s LP039888A6380004097 shell "dumpsys window windows"
info: [debug] Getting focused package and activity
info: [debug] executing cmd: E:\app\android-sdk_r24.3.4-windows\android-sdk-windows\platform-tools\adb.exe -s LP039888A6380004097 shell "dumpsys window windows"
info: [debug] Getting focused package and activity
info: [debug] executing cmd: E:\app\android-sdk_r24.3.4-windows\android-sdk-windows\platform-tools\adb.exe -s LP039888A6380004097 shell "dumpsys window windows"
info: [debug] Getting focused package and activity
info: [debug] executing cmd: E:\app\android-sdk_r24.3.4-windows\android-sdk-windows\platform-tools\adb.exe -s LP039888A6380004097 shell "dumpsys window windows"
info: [debug] Getting focused package and activity
info: [debug] executing cmd: E:\app\android-sdk_r24.3.4-windows\android-sdk-windows\platform-tools\adb.exe -s LP039888A6380004097 shell "dumpsys window windows"
info: [debug] Getting focused package and activity
info: [debug] executing cmd: E:\app\android-sdk_r24.3.4-windows\android-sdk-windows\platform-tools\adb.exe -s LP039888A6380004097 shell "dumpsys window windows"
info: [debug] Getting focused package and activity
info: [debug] executing cmd: E:\app\android-sdk_r24.3.4-windows\android-sdk-windows\platform-tools\adb.exe -s LP039888A6380004097 shell "dumpsys window windows"
info: [debug] Getting focused package and activity
info: [debug] executing cmd: E:\app\android-sdk_r24.3.4-windows\android-sdk-windows\platform-tools\adb.exe -s LP039888A6380004097 shell "dumpsys window windows"
info: [debug] Getting focused package and activity
info: [debug] executing cmd: E:\app\android-sdk_r24.3.4-windows\android-sdk-windows\platform-tools\adb.exe -s LP039888A6380004097 shell "dumpsys window windows"
info: [debug] Getting focused package and activity
info: [debug] executing cmd: E:\app\android-sdk_r24.3.4-windows\android-sdk-windows\platform-tools\adb.exe -s LP039888A6380004097 shell "dumpsys window windows"
info: [debug] Getting focused package and activity
info: [debug] executing cmd: E:\app\android-sdk_r24.3.4-windows\android-sdk-windows\platform-tools\adb.exe -s LP039888A6380004097 shell "dumpsys window windows"
info: [debug] Getting focused package and activity
info: [debug] executing cmd: E:\app\android-sdk_r24.3.4-windows\android-sdk-windows\platform-tools\adb.exe -s LP039888A6380004097 shell "dumpsys window windows"
info: [debug] Getting focused package and activity
info: [debug] executing cmd: E:\app\android-sdk_r24.3.4-windows\android-sdk-windows\platform-tools\adb.exe -s LP039888A6380004097 shell "dumpsys window windows"
info: [debug] Getting focused package and activity
info: [debug] executing cmd: E:\app\android-sdk_r24.3.4-windows\android-sdk-windows\platform-tools\adb.exe -s LP039888A6380004097 shell "dumpsys window windows"
info: [debug] Getting focused package and activity
info: [debug] executing cmd: E:\app\android-sdk_r24.3.4-windows\android-sdk-windows\platform-tools\adb.exe -s LP039888A6380004097 shell "dumpsys window windows"
info: [debug] Getting focused package and activity
info: [debug] executing cmd: E:\app\android-sdk_r24.3.4-windows\android-sdk-windows\platform-tools\adb.exe -s LP039888A6380004097 shell "dumpsys window windows"
info: [debug] Getting focused package and activity
info: [debug] executing cmd: E:\app\android-sdk_r24.3.4-windows\android-sdk-windows\platform-tools\adb.exe -s LP039888A6380004097 shell "dumpsys window windows"
error: com.teaui.starcalendar/com.teaui.calendar.module.MainActivity never started. Current: com.teaui.starcalendar/com.teaui.calendar.module.MainActivity,
info: [debug] Resetting IME to 'com.sohu.inputmethod.sogou.leshi/.SogouIME’
info: [debug] executing cmd: E:\app\android-sdk_r24.3.4-windows\android-sdk-windows\platform-tools\adb.exe -s LP039888A6380004097 shell "ime set com.sohu.inputmethod.sogou.leshi/.SogouIME"
info: [debug] Stopping logcat capture
info: [debug] Logcat terminated with code null, signal SIGTERM
info: [debug] Sent shutdown command, waiting for UiAutomator to stop…
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“shutdown”}
info: [debug] [BOOTSTRAP] [debug] Got command of type SHUTDOWN
info: [debug] [BOOTSTRAP] [debug] Returning result: {“status”:0,“value”:“OK, shutting down”}
info: [debug] [UIAUTOMATOR STDOUT] close [socket][/127.0.0.1:4724]
info: [debug] [BOOTSTRAP] [debug] Closed client connection
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=.
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 0
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [debug] [UIAUTOMATOR STDOUT] Test results for WatcherResultPrinter=.
info: [debug] [UIAUTOMATOR STDOUT] Time: 22.77
info: [debug] [UIAUTOMATOR STDOUT] OK (1 test)
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: -1
error: Failed to start an Appium session, err was: Error: com.teaui.starcalendar/com.teaui.calendar.module.MainActivity never started. Current: com.teaui.starcalendar/com.teaui.calendar.module.MainActivity,
info: [debug] Cleaning up android objects
info: [debug] Cleaning up appium session
info: [debug] Error: com.teaui.starcalendar/com.teaui.calendar.module.MainActivity never started. Current: com.teaui.starcalendar/com.teaui.calendar.module.MainActivity,
at [object Object]. (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:1314:12)
at [object Object]. (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:1258:7)
at [object Object]. (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:180:9)
at ChildProcess.exithandler (child_process.js:742:7)
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. (Original error: com.teaui.starcalendar/com.teaui.calendar.module.MainActivity never started. Current: com.teaui.starcalendar/com.teaui.calendar.module.MainActivity,)”,“origValue”:“com.teaui.starcalendar/com.teaui.calendar.module.MainActivity never started. Current: com.teaui.starcalendar/com.teaui.calendar.module.MainActivity,”},“sessionId”:null}
info: <-- POST /wd/hub/session 500 31606.632 ms - 418

正在回答 回答被采纳积分+3

1回答

提问者 mm5474 2018-12-18 18:10:13

#! /usr/bin/env python

#coding=utf-8

import os

import time

import unittest

from selenium import webdriver

from lib2to3.pgen2.driver import Driver

from lib2to3.tests.support import driver


PATH=lambda p:os.path.abspath(os.path.join(os.path.dirname(__file__),p))


desired_caps = {}

desired_caps['platformName'] = 'Android' #设备系统

desired_caps['platformVersion'] = '6.0' #设备系统版本

desired_caps['deviceName'] = 'LP039888A6380004097' #设备名称

desired_caps['unicodeKeyboard'] = 'True' #设备名称

desired_caps['resetKeyboard'] = 'True' #设备名称


desired_caps['appPackage'] = 'com.teaui.starcalendar'

desired_caps['appActivity'] = 'com.teaui.calendar.module.MainActivity'


driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps, keep_alive=True) #启动app

time.sleep(10)  #启动app时,需要一定时间进入引导页,所以必须设置等待时间,不然下面会一直报错定位不到元素

driver.quit()


0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信