最近在研究Appium做UI自動(dòng)化測(cè)試,下面是在這過(guò)程中遇見(jiàn)的各種問(wèn)題,本問(wèn)題合集使用sample-code進(jìn)行測(cè)試
Appium測(cè)試TestAPP時(shí)報(bào)錯(cuò)解決方法
1. Xcode-Version 7.3.1 (7D1014)使用Appium提供的測(cè)試用例TestAPP時(shí)編譯時(shí)報(bào)錯(cuò):
/Users/HeminWon/Desktop/sample-code-master/sample-code/apps/TestApp/Test App 2/GestureTestViewController.xib: Internal error. Please file a bug at bugreport.apple.com and attach "/var/folders/0m/mm1tf5394t78gnkpxt9jnslc0000gn/T/IB-agent-diagnostics_2016-05-19_23-31-34_869000".
解決方法:
BuildSetting -> Build Settings -> OSACompile-Build Options -> Save as Execute-Only - > No→Yes
參考來(lái)源:LaunchScreen-iPad.xib internal error.
2. 全局代理模式下運(yùn)行appium時(shí),python運(yùn)行腳本不成功
原因:因全局代理模式下下無(wú)法訪(fǎng)問(wèn)到127.0.0.1,所以請(qǐng)關(guān)閉全局代理.
3. 使用測(cè)試用例TestAPP,終端運(yùn)行腳本ios_simple.py時(shí),Appium報(bào)出以下錯(cuò)誤
error: Could not reset simulator. Leaving as is. Error: Command 'xcrun simctl erase 3E6EEACD-7542-447F-B768-2C8FE8B0975E' exited with code 159
解決方法:在Appium的GUI客戶(hù)端中打開(kāi)使用本地仿真庫(kù)
Appium -> iOS Settings - > Advanced -> Use Native Instruments Library 這個(gè)選項(xiàng)打上勾
參考來(lái)源:Appium not running iOS Simulator - Mac OSX El Capitan
4. 使用測(cè)試用例UICatalog,運(yùn)行腳本ios_complex.py時(shí)亿驾,Appium無(wú)法自動(dòng)化測(cè)試并報(bào)出以下錯(cuò)誤
Traceback (most recent call last):
File "ITest0623.py", line 9, in <module>
from appium import webdriver
ImportError: No module named appium
解決方法:安裝的python-client使用Homebrew未完全安裝正確,使用Git下載python-client安裝
git clone https://github.com/appium/python-client
# cd到下載的python-client
cd python-client
#以下命令可能需要使用sudo命令
python setup.py install
參考來(lái)源:http://www.reibang.com/p/a359a43fc48f
5. 使用測(cè)試用例UICatalog,運(yùn)行腳本ios_complex.py時(shí)账嚎,Appium日志顯示以下錯(cuò)誤
error: Failed to start an Appium session, err was: Error: Bad app: /Users/hulianghai/Desktop/sample-code/sample-code/apps/UICatalog/build/release-iphonesimulator/UICatalog.app. App paths need to be absolute, or relative to the appium server install dir, or a URL to compressed file, or a special app name. cause: Error: Error locating the app: ENOENT, stat '/Users/hulianghai/Desktop/sample-code/sample-code/apps/UICatalog/build/release-iphonesimulator/UICatalog.app'
錯(cuò)誤原因:未注意腳本語(yǔ)言里面“app = os.path.abspath”設(shè)置的路徑需要與客戶(hù)端Appium測(cè)試的app路徑保持一致颊乘,參考其他腳本或者官方文檔重新設(shè)置路徑