appium:
info: --> POST /wd/hub/session {"capabilities":{"firstMatch":[{"platformName":"Android","appium:deviceName":"10b4c416","appium:platformVersion":"8.1.0","appium:appPackage":"com.runbey.ybjk","appium:appActivity":"com.runbey.ybjk.MainActivity","appium:appWaitActivity":".MainActivity"}]},"desiredCapabilities":{"platformName":"Android","deviceName":"10b4c416","platformVersion":"8.1.0","appPackage":"com.runbey.ybjk","appActivity":"com.runbey.ybjk.MainActivity","appWaitActivity":".MainActivity"}}
info: Client User-Agent string: appium/python 1.0.1 (selenium/3.141.0 (python windows))
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 18688246-2e75-4142-98de-f58364676e9a
info: Starting android appium
info: [debug] Getting Java version
info: Java version is: 1.8.0_131
info: [debug] Checking whether adb is present
info: [debug] Using adb from C:\Users\JSYPJ\AppData\Local\Android\android-sdk\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: C:\Users\JSYPJ\AppData\Local\Android\android-sdk\platform-tools\adb.exe devices
info: [debug] 1 device(s) connected
info: Found device 10b4c416
info: [debug] Setting device id to 10b4c416
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: C:\Users\JSYPJ\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s 10b4c416 wait-for-device
error: Unhandled error: ReferenceError: grep is not defined
at [object Object].ADB.shell (E:\Appium2\node_modules\appium\node_modules\appium-adb\lib\adb.js:192:46)
at [object Object].<anonymous> (E:\Appium2\node_modules\appium\node_modules\appium-adb\lib\adb.js:942:16)
at [object Object].<anonymous> (E:\Appium2\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) context: [POST /wd/hub/session {"capabilities":{"firstMatch":[{"platformName":"Android","appium:deviceName":"10b4c416","appium:platformVersion":"8.1.0","appium:appPackage":"com.runbey.ybjk","appium:appActivity":"com.runbey.ybjk.Mai]
info: [debug] Retrying restartAdb
info: [debug] executing cmd: C:\Users\JSYPJ\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s 10b4c416 kill-server
info: [debug] Getting connected devices...
info: [debug] executing cmd: C:\Users\JSYPJ\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s 10b4c416 devices
info: [debug] 1 device(s) connected
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: C:\Users\JSYPJ\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s 10b4c416 wait-for-device
error: Unhandled error: ReferenceError: grep is not defined
at [object Object].ADB.shell (E:\Appium2\node_modules\appium\node_modules\appium-adb\lib\adb.js:192:46)
at [object Object].<anonymous> (E:\Appium2\node_modules\appium\node_modules\appium-adb\lib\adb.js:942:16)
at [object Object].<anonymous> (E:\Appium2\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) context: [POST /wd/hub/session {"capabilities":{"firstMatch":[{"platformName":"Android","appium:deviceName":"10b4c416","appium:platformVersion":"8.1.0","appium:appPackage":"com.runbey.ybjk","appium:appActivity":"com.runbey.ybjk.Mai]
info: [debug] Retrying restartAdb
info: [debug] executing cmd: C:\Users\JSYPJ\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s 10b4c416 kill-server
info: [debug] Getting connected devices...
info: [debug] executing cmd: C:\Users\JSYPJ\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s 10b4c416 devices
info: [debug] 1 device(s) connected
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: C:\Users\JSYPJ\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s 10b4c416 wait-for-device
error: Unhandled error: ReferenceError: grep is not defined
at [object Object].ADB.shell (E:\Appium2\node_modules\appium\node_modules\appium-adb\lib\adb.js:192:46)
at [object Object].<anonymous> (E:\Appium2\node_modules\appium\node_modules\appium-adb\lib\adb.js:942:16)
at [object Object].<anonymous> (E:\Appium2\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) context: [POST /wd/hub/session {"capabilities":{"firstMatch":[{"platformName":"Android","appium:deviceName":"10b4c416","appium:platformVersion":"8.1.0","appium:appPackage":"com.runbey.ybjk","appium:appActivity":"com.runbey.ybjk.Mai]
info: [debug] Retrying restartAdb
info: [debug] executing cmd: C:\Users\JSYPJ\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s 10b4c416 kill-server
info: [debug] Getting connected devices...
info: [debug] executing cmd: C:\Users\JSYPJ\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s 10b4c416 devices
info: [debug] 1 device(s) connected
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: C:\Users\JSYPJ\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s 10b4c416 wait-for-device
error: Unhandled error: ReferenceError: grep is not defined
at [object Object].ADB.shell (E:\Appium2\node_modules\appium\node_modules\appium-adb\lib\adb.js:192:46)
at [object Object].<anonymous> (E:\Appium2\node_modules\appium\node_modules\appium-adb\lib\adb.js:942:16)
at [object Object].<anonymous> (E:\Appium2\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) context: [POST /wd/hub/session {"capabilities":{"firstMatch":[{"platformName":"Android","appium:deviceName":"10b4c416","appium:platformVersion":"8.1.0","appium:appPackage":"com.runbey.ybjk","appium:appActivity":"com.runbey.ybjk.Mai]
info: [debug] executing cmd: C:\Users\JSYPJ\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s 10b4c416 kill-server
info: [debug] Getting connected devices...
info: [debug] executing cmd: C:\Users\JSYPJ\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s 10b4c416 devices
info: [debug] 1 device(s) connected
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: C:\Users\JSYPJ\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s 10b4c416 wait-for-device
error: Unhandled error: ReferenceError: grep is not defined
at [object Object].ADB.shell (E:\Appium2\node_modules\appium\node_modules\appium-adb\lib\adb.js:192:46)
at [object Object].<anonymous> (E:\Appium2\node_modules\appium\node_modules\appium-adb\lib\adb.js:942:16)
at [object Object].<anonymous> (E:\Appium2\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) context: [POST /wd/hub/session {"capabilities":{"firstMatch":[{"platformName":"Android","appium:deviceName":"10b4c416","appium:platformVersion":"8.1.0","appium:appPackage":"com.runbey.ybjk","appium:appActivity":"com.runbey.ybjk.Mai]
info: [debug] Sent shutdown command, waiting for UiAutomator to stop...
warn: UiAutomator did not shut down fast enough, calling it gone
info: [debug] Cleaning up android objects
info: [debug] Cleaning up appium session
error: Failed to start an Appium session, err was: Device did not become ready in 5 secs; are you sure it's powered on?
info: [debug] undefined
info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created.","origValue":"Device did not become ready in 5 secs; are you sure it's powered on?"},"sessionId":null}
info: <-- POST /wd/hub/session 500 50297.508 ms - 171
uploading-image-729309.png
pycharm:
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: A new session could not be created.
代码:
from appium import webdriver
desired_caps = { 'platformName':'Android',
'deviceName': '10b4c416',
'platformVersion':'8.1.0',
'appPackage':'com.runbey.ybjk',
"appActivity":"com.runbey.ybjk.MainActivity",
}
driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)