2014-02-25 191 views
1

Im新的appium和計劃使用它的統一遊戲自動化。但是我似乎無法找到應用程序將如何在仿真器/設備上啓動?下面是我已經做應用程序不會在仿真器/設備上使用appium

  1. 的步驟來啓動仿真器或連接的設備(因爲只有一個應連接)
  2. 啓動使用appium應用
  3. 的appium服務器從終端
  4. 冉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的。 我在這裏錯過了一些微不足道的東西嗎?

回答

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>更改爲實際的字符串。

2

我已經錯誤地設置爲路徑變量

..../sdk/tools/ 

代替

..../sdk/ 

更改該固定它。

相關問題