首页 文章

应用程序无法使用appium在模拟器/设备上启动

提问于
浏览
1

我是appium的新手,并计划将其用于统一游戏自动化 . 但是我似乎无法找到如何在模拟器/设备上启动应用程序?以下是我所做的步骤

  • 启动仿真器或连接设备(因为只应连接一个)

  • 使用appium app启动appium服务器

  • 从终端运行python脚本

我正在尝试使用联系人管理器示例应用程序 . 下面是python代码

import os
from time import sleep

from selenium import webdriver

# Returns abs path relative to this file and not cwd
PATH = lambda p: os.path.abspath(
    os.path.join(os.path.dirname(__file__), p)
)

desired_caps = {}
desired_caps['device'] = 'Android'
desired_caps['browserName'] = ''
desired_caps['version'] = '4.2'
desired_caps['app'] = PATH('/Users/<uname>/Downloads/ContactManager.apk')
desired_caps['app-package'] = 'com.example.android.contactmanager'
desired_caps['app-activity'] = '.ContactManager'
driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)

print driver.get_window_size()

以下是appium应用程序的日志

info: Using local app from desiredCaps: /Users/ears/Downloads/ContactManager.apk

debug: Request received with params: {"sessionId":null,"desiredCapabilities":{"app-package":"com.example.android.contactmanager","app":"/Users/<uname>/Downloads/ContactManager.apk","browserName":"","version":"4.2","device":"Android","app-activity":".ContactManager"}}
debug: Using fast reset? true

info: Creating new appium session 250e7bfd-92bf-4b2a-894c-f4a0e2d02ce7
info: Starting android appium
info: Preparing device for session
info: Checking whether app is actually present
info: Checking whether adb is present

debug: Appium request initiated at /wd/hub/status

info: Responding to client with success: {"status":0,"value":{"build":{"version":"0.15.0","revision":"a7b47d73a27074cc928cc5b325e5d4de1b6e5594"}},"sessionId":"250e7bfd-92bf-4b2a-894c-f4a0e2d02ce7"}

debug: Request received with params: {}

GET /wd/hub/status 200 1ms - 199b

我在哪里可以找到详细的日志?它不会在模拟器上启动应用程序 . 我在Mac上,这是Android . 我在这里错过了一些小事吗?

2 回答

  • 2

    我错误地设置了路径变量

    ..../sdk/tools/
    

    代替

    ..../sdk/
    

    改变它固定它 .

  • 0

    通过阅读appium日志突出显示代码中的问题,尤其是以下行:

    debug: Request received with params: {"sessionId":null,"desiredCapabilities":{"app-package":"com.example.android.contactmanager","app":"/Users//Downloads/ContactManager.apk","browserName":"","version":"4.2","device":"Android","app-activity":".ContactManager"}} debug: Using fast reset? true

    您可以看到它包含路径 /Users//Downloads/ContactManager.apk ,它不是有效路径 . 看起来您需要将代码中的 <uname> 更改为实际字符串 .

相关问题