IOS+Appium自动化遇到的问题汇总

python第三方库pymssql无法使用

(因重新安装brew,python等应用后导致,重装后可以使用)

freetds源码下载地址:

ftp://ftp.freetds.org/pub/freetds/stable/

pymssql源码下载地址:

https://pypi.python.org/pypi/pymssql/

先用 brew list 查看已经安装的包

如果已经安装freetds,则使用 brew uninstall freetds先卸载

brew unlink freetds

brew uninstall freetds

再安装 0.91版本

brew install [email protected]

brew link —force [email protected]

最后安装pymssql

pip install pymssql

 

2.  ipa包无法安装(直接用命令安装)

l  安装ipa文件时Error

An unknown server-side error occurred whileprocessing the command. Original error: Could not install app: 'Command' ios-deploy --id --bundle /var/folders/y0/xym5tvts0pz81dc4kcm9j6y80000gn/T/20171121-35740-uzjmov.hmzakh85mi/Payload/xx.app'exited with code 253'

webDriverAgent安装好以后,只要bundleID正确即可无需每次都重新安装)

试着用下面的命令安装ipa包,安装成功:

ideviceinstaller -i /.../xx.ipa -o

试着用下面的命令安装ipa包,安装成功:

ios-deploy --id --bundle

Appium安装需要同样的证书,打包成ipa包,然后用Appium Inspector启动session安装或者用python代码连接并安装应用。

 

一旦卸载brew需要重新安装由brew安装的程序:python,git,node等

卸载brew,使用brew安装最新版的应用需要先安装最新的brew

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

 

重新安装最新的brew

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

 

重新安装其他由brew安装的程序:

$ brew install node

$ brew link --overwrite node

$ brew install git

$ brew install python3

 

多个版本共存用pyenv安装过程:

brew upgrade pyenv

brew uninstall --force python3

pyenv install -l

pyenv install 3.6.4rc1

pyenv versions

pyenv global 3.6.4rc1

 

配置环境变量到.bash_profile

export PYENV_ROOT="$HOME/.pyenv"

export PATH="$PYENV_ROOT/bin:$PATH"

eval "$(pyenv init -)"

 

PATH环境变量错误,无法进入命令行

1,在命令行中输入

exportPATH=/usr/bin:/usr/sbin:/bin:/sbin:/usr/X11R6/bin

这样可以保证命令行命令暂时可以使用。命令执行完之后先不要关闭终端

或者cd /usr/bin 下执行vi命令

2. 如果先前修改bash_profile恢复文件, 

vi ~/.bash_profile 

3. 很有可能是你的PATH环境变量设置错误,比如 $PATH 漏了

PATH=$PATH:$PATH1

可以写成这样的格式:exportPATH=/usr/local/msyql/bin:$PATH

4. 立即生效,source ~/.bash_profile

open .bash_profile

 

解决PATH环境变量配置错误:

1.clone一个pyenv项目

 $ git clone https://github.com/pyenv/pyenv.git ~/.pyenv

2.定义环境变量

$ echo 'exportPYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile

$ echo 'exportPATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile

3.增加pyenvinit到shell

$ echo 'eval "$(pyenv init -)"' >> ~/.bash_profile

 

l  重新安装WDA最新的相关依赖

ios安装xcpretty

$ gem update –system

$ sudo gem install xcpretty

重新安装最新的carthage

$ brew install carthage

重新安装最新的libimobiledevice

$ brew install -s --HEAD libimobiledeviceideviceinstaller

 

l   安装npm

$ npm install —registry=https://registry.npm.taobao.org

$ npm install --save latest-version

重新安装iso-deploy

$ npm install -g ios-deploy

 

l   官网获取最新的WDA重新执行bootstrap:

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

$ mkdir -p /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Resources/WebDriverAgent.bundle

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

$ sh ./Scripts/bootstrap.sh

$ xcodebuild build-for-testing test-without-building-project /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination id= -configuration Debug

WDA启动成功日志:

LiuMingdeMacBook-Air:WebDriverAgent liuming$ xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=' test

2017-12-20 22:29:53.303 xcodebuild[6311:785940] ...........<此部分省略最后有下面的内容就安装成功>............

Test Suite 'All tests' started at 2017-12-20 22:30:02.267

Test Suite 'WebDriverAgentRunner.xctest' started at 2017-12-2022:30:02.268

Test Suite 'UITestingUITests' started at 2017-12-20 22:30:02.269

Test Case '-[UITestingUITeststestRunner]' started.

    t =     0.00s Start Test at 2017-12-2022:30:02.270

    t =     0.00s Set Up

2017-12-20 22:30:02.297031+0800 WebDriverAgentRunner-Runner[1238:583584] Built at Dec 20 2017 17:54:23

2017-12-20 22:30:02.335888+0800 WebDriverAgentRunner-Runner[1238:583584]ServerURLHere->http://xx.xx.xx.xx:0<-ServerURLHere

 

l   安装app-inspector:

$ npm install macaca-cli -g

$ macaca doctor

$ brew install ios-webkit-debug-proxy

$ brew install gradle

$ npm i app-inspector -g

 

l   配置app-inspector:

1.     Xcode打开/usr/local/lib/node_modules/app-inspector/node_modules/xctestwd/XCTestWD/XCTestWD.xcodeproj 

2.     signing下面,选择自己的developer id,修改bundle id

3.    执行以下命令将配置好的驱动装上ios手机

$ cd/usr/local/lib/node_modules/app-inspector/node_modules/xctestwd/XCTestWD

$ xcodebuild-project XCTestWD.xcodeproj -scheme XCTestWDUITests -destination 'platform=iOS,id='XCTESTWD_PORT=8001 clean test

4.    执行以下命令启动服务

$ app-inspector -u

 

你可能感兴趣的:(Appium,计算机Mac)