当前位置: 首页 > 知识库问答 >
问题:

Appium无法启动新会话

顾正初
2023-03-14

我正试图使用Appium从mac上的Android应用程序启动我的应用程序。应用程序
或使用我的代码,但我得到一个错误

无法启动新会话。

确保Appium服务器运行的应用程序是通过使用Appium中的“App Path”参数打开的。应用程序(以及适用于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个答案

庞意智
2023-03-14

终于修好了。以下是对我有效的解决方案:

我改变了很多东西,最后终于把它改对了。看起来更像是我机器上的配置问题。

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

  1. 从brew安装appium
  2. 从brew安装节点
  3. 在Appium设置中,将服务器地址设置为在与常规4723不同的端口上运行(我的是4724)
  4. 在Appium设置中,从appium中的设置启用了“覆盖现有会话”
  5. 在Appium设置中,在启动前使用服务器端口杀死处理器
  6. 在Android设置中,启用“完全重置”
  7. 在Android设置中,“意图行动”
  8. 在Android设置中,“意图类别”
  9. 在Android设置中,“设备就绪超时”5s
墨高杰
2023-03-14
emulator-5554 shell stop' exited with code 
1{"stdout":"","stderr":"stop: must be root\n","code":1}

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

 类似资料:
  • 环境 Xcode版本:11.0(11A420A) Appium desktop版本:1.13.0 Appium CLI版本:1.16.0-beta.1 用于运行Appium的桌面操作系统/版本:Mac OS 10.14.6 node.js版本(除非使用appium.dmg):12.10.0 移动平台/测试中版本:iOS 13.0 模拟器:iPhone 8 Appium服务器:Appium CLI和

  • 我为考试写的贝娄类: 公共类测试应用程序 {AppiumDriver驱动程序; 信息:<--POST/wd/hub/session 500 210 49.722ms-1390 谢谢你帮我解决这件事。谢谢你

  • 在Appium中开始会话时,我收到以下错误: 错误: 处理命令时发生未知的服务器端错误。原始错误:执行adbExec时出错。原始错误:'命令'C:\用户\satyajit.more\AppData\本地\Android\Sdk\平台工具\adb.exe-P 5037-s模拟器-5554 install'E:\Appium Setup\MobileInsurance_QA_16062018.apk"

  • 嘿,伙计们,所以我基本上已经做了需要做的事情,使appium上升和运行。安装JDK1.8(最新版本),安装Android SDK,更新环境变量,安装Appium1.4(最新版本),安装Eclipse,并在将手机连接到PC后创建一个新的java项目。 我将.apk文件导入到项目中,然后设置所需的功能。我的代码中没有任何错误。启动appium后,我运行代码,得到以下错误: 下面是我的代码:

  • 我在所有浏览器中都遇到了这个例外。例如,我在chrome上创建了一个远程webdriver,如下所示: 我得到了UnreachableBrowserException如下: 但我在<代码>http://myIP:4444/grid/console,一切正常,节点仍然注册。然后在<代码>http://myIP:5555/wd/hub/static/resource/hub.html,我仍然可以单击“