Appium无法开始新的会话

时间:2016-09-26 17:15:44

标签: selenium selenium-webdriver appium

我尝试使用Appium.app从我的Mac中的Android应用程序启动我的应用程序 或使用我的代码,但我收到错误

无法开始新会话。

确保Appium服务器正在运行,并且应用程序已打开 使用" App Path" Appium.app中的参数(以及包和
Android的活动)或通过连接selenium客户端和
在期望的能力对象中提供它。"

Launching Appium with command: export     
ANDROID_HOME="/Users/user1/Library/Android/sdk/"; 
'/Applications/Appium.app/Contents/Resources/node/bin/node'             
appium/build/lib/main.js --port "4724" --session-override --debug-log-    
spacing --automation-name "Appium" --platform-name "Android" --
platform-version "4.4" --app     "/Users/user1/WorkSpace/Automation/automation/automation_tests/selenium/src    /test/resources/myApp.apk" --full-reset --dont-stop-app-on-reset --avd     
"10_1_WXGA_Tablet_API_24" --app-pkg "com.myApp.com" --app-activity     
"com.myApp.com.activities.MainActivity" --app-wait-package     
"com.myApp.com" --app-wait-activity 
"com.myApp.com.activities.AndroidDatabaseManager" --device-name 
"10_1_WXGA_Tablet_API_24" --language "en" --intent-action     
"android.intent.action.MAIN" --intent-category 
"android.intent.category.LAUNCHER"

[Appium] Welcome to Appium v1.5.3

[Appium] Non-default server args:

[Appium]   port: 4724
[Appium]   sessionOverride: true
[Appium]   debugLogSpacing: true
[Appium]   platformName: 'Android'
[Appium]   platformVersion: '4.4'

[Appium]   automationName: 'Appium'
[Appium]   deviceName: '10_1_WXGA_Tablet_API_24'
[Appium]   app:     
'/Users/user1/WorkSpace/Automation/automation/automation_tests/selenium/src
/test/resources/MyApp.apk’
[Appium]   language: 'en'
[Appium]   fullReset: true
[Appium]   appPackage: 'com.myapp.com’
[Appium]   appActivity: 'com.myapp.MainActivity'
[Appium]   appWaitPackage: 'com.myApp.com'
[Appium]   appWaitActivity: 
'com.myApp.com.activities.AndroidDatabaseManager'
[Appium]   avd: '10_1_WXGA_Tablet_API_24'
[Appium]   dontStopAppOnReset: true
[Appium] Deprecated server args:
[Appium]   --platform-name => --default-capabilities     
'{"platformName":"Android"}'
[Appium]   --platform-version => --default-capabilities     
'{"platformVersion":"4.4"}'
[Appium]   --automation-name => --default-capabilities 
'{"automationName":"Appium"}'
[Appium]   --device-name => --default-capabilities     
'{"deviceName":"10_1_WXGA_Tablet_API_24"}'
[Appium]   --app => --default-capabilities     
'{"app":"/Users/user1/WorkSpace/Automation/automation/_automation_tests/sel    enium/src/test/resources/myApp.apk"}'
[Appium]   --language => --default-capabilities '{"language":"en"}'

[Appium]   --full-reset => --default-capabilities '{"fullReset":true}'
[Appium]   --app-pkg => --default-capabilities     
'{"appPackage":"com.myApp.com"}'
[Appium]   --app-activity => --default-capabilities     
'{"appActivity":"com.myApp.com.activities.MainActivity"}'
[Appium]   --app-wait-package => --default-capabilities 
'{"appWaitPackage":"com.myApp.com"}'
[Appium]   --app-wait-activity => --default-capabilities     
'{"appWaitActivity":"com.myApp.com.activities.AndroidDatabaseManager"}'
[Appium]   --avd => --default-capabilities     
'{"avd":"10_1_WXGA_Tablet_API_24"}'
[Appium]   --dont-stop-app-on-reset => --default-capabilities     
'{"dontStopAppOnReset":true}'
[Appium] Default capabilities, which will be added to each request     
unless overridden by desired capabilities:

[Appium]   platformName: 'Android'

[Appium]   platformVersion: '4.4'
[Appium]   automationName: 'Appium'
[Appium]   deviceName: '10_1_WXGA_Tablet_API_24'
[Appium]   app: 
'/Users/user1/WorkSpace/Automation/automation/automation_tests/selenium/src
/test/resources/myApp.apk'
[Appium]   language: 'en'
[Appium]   fullReset: true
[Appium]   appPackage: 'com.myApp.com'
[Appium]   appActivity: 'com.myApp.com.activities.MainActivity'
[Appium]   appWaitPackage: 'com.myApp.com'
[Appium]   appWaitActivity: 
'com.myApp.com.activities.AndroidDatabaseManager'
[Appium]   avd: '10_1_WXGA_Tablet_API_24'
[Appium]   dontStopAppOnReset: true

[Appium] Appium REST http interface listener started on 0.0.0.0:4724

[HTTP] --> GET /wd/hub/status {}

[MJSONWP] Calling AppiumDriver.getStatus() with args: []





[debug] [ADB] Device API level: 24

[debug] [ADB] Getting connected devices...

[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running /Users/user1/Library/Android/sdk/platform-
tools/adb with args: ["-P",5037,"-s","emulator-
5554","shell","getprop","persist.sys.locale"]
[debug] [ADB] Current device property 'persist.sys.locale': 
[debug] [ADB] Getting connected devices...

[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running /Users/user1/Library/Android/sdk/platform-
tools/adb with args: ["-P",5037,"-s","emulator-
5554","shell","getprop","ro.product.locale"]

[HTTP] <-- GET /wd/hub/status - - ms - - 

[debug] [ADB] Current device property 'ro.product.locale': en-US

[debug] [ADB] Setting device property 'persist.sys.locale' to 'en'
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running /Users/user1/Library/Android/sdk/platform-
tools/adb with args: ["-P",5037,"-s","emulator-
5554","shell","setprop","persist.sys.locale","en"]

[debug] [ADB] Getting connected devices...

[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running /Users/user1/Library/Android/sdk/platform-
tools/adb with args: ["-P",5037,"-s","emulator-5554","shell","stop"]

[debug] [ADB] Running /Users/user1/Library/Android/sdk/platform-
tools/adb with args: ["-P",5037,"-s","emulator-5554","shell","stop"]



[AndroidDriver] Cannot shut down Android driver; it has already shut     
down

[MJSONWP] Encountered internal error running command: Error: Error     
executing adbExec. Original error: Command 
'/Users/user1/Library/Android/sdk/platform-tools/adb -P 5037 -s 
emulator-5554 shell stop' exited with code 
1{"stdout":"","stderr":"stop: must be root\n","code":1}
    at ADB.execFunc$ (lib/tools/system-calls.js:189:13)
    at tryCatch 
(/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modul
es/babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke]     (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modul    es/babel-runtime/regenerator/runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as 
throw] 
(/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modul    es/babel-runtime/regenerator/runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke     
(/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modul    es/babel-runtime/regenerator/runtime.js:136:37)
    at run     
(/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modul    es/babel-runtime/node_modules/core-    
js/library/modules/es6.promise.js:104:47)
    at     
/Applications/Appium.app/Contents/Resources/node_modules/appium/node_module    s/babel-runtime/node_modules/core-    
js/library/modules/es6.promise.js:115:28
    at flush 
(/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modul    es/babel-runtime/node_modules/core-js/library/modules/$.microtask.js:19:5)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)

以下是我的Appium日志 我在这里做错了什么?

2 个答案:

答案 0 :(得分:0)

>>> import numpy as np
>>> import tensorflow as tf
>>> def softmax(x):
...     return np.exp(x);
... softmax([1])
SyntaxError: invalid syntax

这可能是您安装节点的方式的问题。你是怎么安装它的?如果您通过快速安装nodejs站点安装了节点,请尝试使用自制软件卸载并再次安装。

答案 1 :(得分:0)

最后修好了。以下是适用于我的解决方案:

我改变了很多东西,最后弄明白了。看起来更像是我机器上的配置问题。

下面是appium应用程序的设置(尚未将其转换为java代码):

  1. 从brew
  2. 安装appium
  3. 从brew
  4. 安装节点
  5. 在Appium设置中,使服务器地址在与常规4723不同的端口上运行(我的是4724)
  6. 在Appium设置中,从appium
  7. 中的设置启用“Over ride Existing sessions”
  8. 在Appium设置中,在启动前使用服务器端口终止处理器
  9. 在Android设置中,启用“完全重置”
  10. 在Android设置中,“意图行动”
  11. 在Android设置中,“意图类别”
  12. 在Android设置中,“设备就绪超时”5s