我是appium的新手,并计划将其用于团结游戏自动化。但是我似乎无法找到如何在模拟器/设备上启动应用程序?以下是我已经完成的步骤
我正在尝试使用联系人管理器示例应用。下面是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 app的日志
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。 我在这里错过了一些小事吗?
答案 0 :(得分:2)
我错误地将路径变量设置为
..../sdk/tools/
而不是
..../sdk/
更改此修复它。
答案 1 :(得分: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>
更改为实际字符串。