1

私は appium を初めて使用し、ユニティ ゲームの自動化に使用する予定です。ただし、エミュレーター/デバイスでアプリケーションを起動する方法がわかりませんか? 以下は私が行った手順です

  1. エミュレーターを起動するか、デバイスを接続します (接続する必要があるのは 1 つだけであるため)。
  2. appium アプリを使用して appium サーバーを起動する
  3. ターミナルから 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用です。ここで些細なことを見逃していますか?

4

2 に答える 2

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有効なパスではないpath が含まれていることがわかります。<uname>コードを実際の文字列に変更する必要があるようです。

于 2014-02-25T18:21:56.020 に答える