溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

Xcode9.0+appium1.6.5真機環(huán)境運行app及

發(fā)布時間:2020-06-17 03:20:31 來源:網(wǎng)絡(luò) 閱讀:15731 作者:niedongri 欄目:移動開發(fā)

Mac下把appium自動化環(huán)境搭建好后,進行真機測試時會碰到相當多的坑,

 

下面給大家一一列出來并附上解決方法。

 

一、selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Could not initialize ideviceinstaller; make sure it is installed and works on your system

 

這是沒有安裝ideviceinstaller導致。

 

解決方法:

1.解決方法在終端執(zhí)行,先安裝brew:

/usr/bin/ruby -e "$(curl -fsSL  https://raw.githubusercontent.com/Homebrew/install/master/install)"

 

2.裝好brew后,在執(zhí)行下面指令裝ideviceinstaller:

 

brew install  ideviceinstaller

 

二、

selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Could not find Automation.tracetemplate in any of the followinglocations /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate,/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate

 

報錯原因是沒有安裝Automation.tracetemplate模塊。我用的是appium1.5.3 、Xcode8。

Xcode8移除了UI Automation

 

解決方法:

裝個桌面版的appium 1.6.5可以解決這個問題。到我的網(wǎng)盤下載。

鏈接:http://pan.baidu.com/s/1qYPYGd2  密碼:f2o7

 

查看自帶的appium-xcuitest-driver版本,npm list查看,版本如果不是2.5.3或更新請卸載再裝(自帶的版本太老會導致app launch不起來,一直在等待)

卸載:npm uninstall appium-xcuitest-driver

安裝:npm install appium-xcuitest-driver@2.5.3

 

三、通過指令安裝brew install libimobiledevice

四、通過指令安裝npm install -g ios-deploy

 

不安裝會報以下錯誤:

[XCUITest] Could notinitialize ios-deploy make sure it is installed and works on your system

五、指令安裝gem install xcpretty這可以使xcode輸出更合理

六、 指令安裝npm i -g webpack 

 

這和WebDriverAgent相關(guān),沒有這個 會報錯:Unable to create new remotesession

 

七、selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Unable to launch WebDriverAgent because of xcodebuild failure: xcodebuild failed with code 65

 

WebDriverAgent報錯,需要安裝。

解決方法:

1.必須先安裝Carthage,執(zhí)行指令:brew installCarthage

 

2.安裝WebDriverAgent:

   cd /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent(自己的appium路徑在哪就去哪找)

先執(zhí)行mkdir -pResources/WebDriverAgent.bundle

再執(zhí)行sh ./Scripts/bootstrap.sh(執(zhí)行這個指令前最好鏈接***不然等待非常久)

   編譯WebDriverAgent.xcodeproj(以上這個是安裝自帶的,大家不要裝)

 

自帶的webdriveragent有問題,自己下一個,不然用自帶的在xcode上編譯報各種錯誤。。。搞死你。。。。 我這里被折騰了1天多。。。。各種百度各種谷歌。按下面解決:

   cd ~

  git clone https://github.com/facebook/WebDriverAgent.git

  cd WebDriverAgent

  mkdir -p Resources/WebDriverAgent.bundle

   sh ./Scripts/bootstrap.sh

   然后進入到appium-xcuitest-driver路徑

  cd/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/

  rm –rf WebDriverAgent(移除自帶的,當然如果沒有安裝自帶的就不用執(zhí)行這個指令)

  ln –s ~/WebDriverAgent WebDriverAgent(引用自己下載的webdriveragent)

   編譯WebDriverAgent.xcodeproj

編譯要修改的地方:

1.   在xcode添加開發(fā)者賬號:

Xcode9.0+appium1.6.5真機環(huán)境運行app及


2.   設(shè)置WebDriverAgentLib-General選項:

Xcode9.0+appium1.6.5真機環(huán)境運行app及


3.   設(shè)置WebDriverAgentLib-Build Settings選項

Xcode9.0+appium1.6.5真機環(huán)境運行app及


這里面的Product Bundle Identifler一定要改一下,不能完全一樣??梢园裦acebook改成自己的名字拼音

 

4.   設(shè)置WebDriverAgentRunner---General和Build Settings選項

和設(shè)置webdriveragentlig的一樣,就不截圖。

1.   General里選擇signing里勾選Automatically manage signing選項,并且選上自己的開發(fā)賬號。

 

2.   Build Settings里修改一下Bundle Identifier的名稱即可。

 

 

接下來就是連接真機編譯,真機編譯后要安裝到手機,安裝到手機有兩種方法:

一、用指令

 cd /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent

執(zhí)行:

    xcodebuild -projectWebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=真機的udid'test

 

二、在Xcode里面執(zhí)行test安裝

 

安裝過程會王手機里安裝一個webdriveragent的app,無圖標,打開一般都是黑色。

安裝過程會出現(xiàn)自動打開和退出這個app的現(xiàn)象。

之后就可以運行python代碼了。

 

注:如果按以上執(zhí)行還不行就換個usb口,小的就是換了個usb口就可以運行真機上的app了。切記切記??!

 

QQ交流群610845268


向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI