测试人社区

使用appium无法启动网易mumu

问题描述:使用appium无法启动网易mumu

  • 环境:win10
  • 移动端型号:网易mumu
  • 移动端系统:6.0
  • 问题复述:使用appium无法启动网易mumu

相关log文件(没有提交log的权限)

[info] e[35m[Appium]e[39m Welcome to Appium v1.15.1
[info] e[35m[Appium]e[39m Non-default server args:
[info] e[35m[Appium]e[39m   allowInsecure: {
[info] e[35m[Appium]e[39m   }
[info] e[35m[Appium]e[39m   denyInsecure: {
[info] e[35m[Appium]e[39m   }
[info] e[35m[Appium]e[39m Appium REST http interface listener started on 0.0.0.0:4723[info] e[35m[HTTP]e[39m e[37m-->e[39m e[37mPOSTe[39m e[37m/wd/hub/sessione[39m
[info] e[35m[HTTP]e[39m e[90m{"capabilities":{"firstMatch":[{"platformName":"Android","appium:platformVersion":"6.0","appium:devicesName":"emulator-7555","appium:appPackage":"com.android.settings","appium:appActivity":"com.android.settings.Settings"}]},"desiredCapabilities":{"platformName":"Android","platformVersion":"6.0","devicesName":"emulator-7555","appPackage":"com.android.settings","appActivity":"com.android.settings.Settings"}}e[39m
[debug] e[35m[W3C]e[39m Calling AppiumDriver.createSession() with args: [{"platformName":"Android","platformVersion":"6.0","devicesName":"emulator-7555","appPackage":"com.android.settings","appActivity":"com.android.settings.Settings"},null,{"firstMatch":[{"platformName":"Android","appium:platformVersion":"6.0","appium:devicesName":"emulator-7555","appium:appPackage":"com.android.settings","appium:appActivity":"com.android.settings.Settings"}]}]
[debug] e[35m[BaseDriver]e[39m Event 'newSessionRequested' logged at 1586791763559 (23:29:23 GMT+0800 (中国标准时间))
[info] e[35m[Appium]e[39m Could not parse W3C capabilities: 'deviceName' can't be blank
[info] e[35m[Appium]e[39m Trying to fix W3C capabilities by merging them with JSONWP caps
[warn] e[35m[BaseDriver]e[39m The capabilities ["platformVersion","devicesName","appPackage","appActivity"] are not standard capabilities and should have an extension prefix
[warn] e[35m[Appium]e[39m Could not parse fixed W3C capabilities: 'deviceName' can't be blank. Falling back to JSONWP protocol
[warn] e[35m[Appium]e[39m 
[warn] e[35m[Appium]e[39m ======================================================================
[warn] e[35m[Appium]e[39m   DEPRECATION WARNING:
[warn] e[35m[Appium]e[39m 
[warn] e[35m[Appium]e[39m   The 'automationName' capability was not provided in the desired 
[warn] e[35m[Appium]e[39m   capabilities for this Android session
[warn] e[35m[Appium]e[39m 
[warn] e[35m[Appium]e[39m   Setting 'automationName=UiAutomator2' by default and using the 
[warn] e[35m[Appium]e[39m   UiAutomator2 Driver
[warn] e[35m[Appium]e[39m 
[warn] e[35m[Appium]e[39m   The next major version of Appium (2.x) will **require** the 
[warn] e[35m[Appium]e[39m   'automationName' capability to be set for all sessions on all 
[warn] e[35m[Appium]e[39m   platforms
[warn] e[35m[Appium]e[39m 
[warn] e[35m[Appium]e[39m   In previous versions (Appium <= 1.13.x), the default was 
[warn] e[35m[Appium]e[39m   'automationName=UiAutomator1'
[warn] e[35m[Appium]e[39m 
[warn] e[35m[Appium]e[39m   If you wish to use that automation instead of UiAutomator2, please 
[warn] e[35m[Appium]e[39m   add 'automationName=UiAutomator1' to your desired capabilities
[warn] e[35m[Appium]e[39m 
[warn] e[35m[Appium]e[39m   For more information about drivers, please visit 
[warn] e[35m[Appium]e[39m   http://appium.io/docs/en/about-appium/intro/ and explore the 
[warn] e[35m[Appium]e[39m   'Drivers' menu
[warn] e[35m[Appium]e[39m 
[warn] e[35m[Appium]e[39m ======================================================================
[warn] e[35m[Appium]e[39m 
[info] e[35m[Appium]e[39m Appium v1.15.1 creating new AndroidUiautomator2Driver (v1.37.2) session
[debug] e[35m[BaseDriver]e[39m Creating session with MJSONWP desired capabilities: {
[debug] e[35m[BaseDriver]e[39m   "platformName": "Android",
[debug] e[35m[BaseDriver]e[39m   "platformVersion": "6.0",
[debug] e[35m[BaseDriver]e[39m   "devicesName": "emulator-7555",
[debug] e[35m[BaseDriver]e[39m   "appPackage": "com.android.settings",
[debug] e[35m[BaseDriver]e[39m   "appActivity": "com.android.settings.Settings"
[debug] e[35m[BaseDriver]e[39m }
[error] e[35m[BaseDriver]e[39m SessionNotCreatedError: A new session could not be created. Details: The desiredCapabilities object was not valid for the following reason(s): 'deviceName' can't be blank
[error] e[35m[BaseDriver]e[39m     at AndroidUiautomator2Driver.validateDesiredCaps (C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\basedriver\driver.js:225:25)
[error] e[35m[BaseDriver]e[39m     at AndroidUiautomator2Driver.validateDesiredCaps (C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-driver\lib\driver.js:145:18)
[error] e[35m[BaseDriver]e[39m     at AndroidUiautomator2Driver.validateDesiredCaps [as createSession] (C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\basedriver\commands\session.js:46:8)
[error] e[35m[BaseDriver]e[39m     at AndroidUiautomator2Driver.createSession (C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-driver\lib\driver.js:151:43)
[error] e[35m[BaseDriver]e[39m     at AppiumDriver.createSession (C:\Program Files\Appium\resources\app\node_modules\appium\lib\appium.js:353:43)
[error] e[35m[BaseDriver]e[39m     at process._tickCallback (internal/process/next_tick.js:68:7)
[debug] e[35m[UiAutomator2]e[39m Deleting UiAutomator2 session
[debug] e[35m[BaseDriver]e[39m Event 'newSessionStarted' logged at 1586791763597 (23:29:23 GMT+0800 (中国标准时间))
[debug] e[35m[MJSONWP]e[39m Encountered internal error running command: SessionNotCreatedError: A new session could not be created. Details: The desiredCapabilities object was not valid for the following reason(s): 'deviceName' can't be blank
[debug] e[35m[MJSONWP]e[39m     at AndroidUiautomator2Driver.validateDesiredCaps (C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\basedriver\driver.js:225:25)
[debug] e[35m[MJSONWP]e[39m     at AndroidUiautomator2Driver.validateDesiredCaps (C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-driver\lib\driver.js:145:18)
[debug] e[35m[MJSONWP]e[39m     at AndroidUiautomator2Driver.validateDesiredCaps [as createSession] (C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\basedriver\commands\session.js:46:8)
[debug] e[35m[MJSONWP]e[39m     at AndroidUiautomator2Driver.createSession (C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-driver\lib\driver.js:151:43)
[debug] e[35m[MJSONWP]e[39m     at AppiumDriver.createSession (C:\Program Files\Appium\resources\app\node_modules\appium\lib\appium.js:353:43)
[debug] e[35m[MJSONWP]e[39m     at process._tickCallback (internal/process/next_tick.js:68:7)
[info] e[35m[HTTP]e[39m e[37m<-- POST /wd/hub/session e[39me[31m500e[39m e[90m45 ms - 199e[39m
[info] e[35m[HTTP]e[39m e[90me[39m

直接将后缀名为.log的文件拖入输入框即可

相关代码(包括log文件,都要使用markdown代码格式,)

from appium import webdriver

desired_caps = {}
desired_caps['platformName'] = 'Android'
desired_caps['platformVersion'] = '6.0'
desired_caps['devicesName'] = 'emulator-7555'
desired_caps['appPackage'] = 'com.android.settings'
desired_caps['appActivity'] = 'com.android.settings.Settings'
driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
driver.quit()

报错信息:selenium.common.exceptions.SessionNotCreatedException: Message: A new session could not be created. Details: The desiredCapabilities object was not valid for the following reason(s): ‘deviceName’ can’t be blank

原因以及解决方式(没有可以写无):

原因:

解决办法:

device name应该是 adb devices 后,列表中左边的那个名称
image

那个配置项是 deviceName 你写的是 devicesName 多了个s 注意字段准确性哈~