mac安装Python+appium 环境步骤
1、首先安装jdk https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
下载文件: jdk-8u141-macosx-x64.dmg
打开终端 查看jdk安装:Java -version
2、git 程序
命令行中输入:git --version
3、ruby 程序
命令行中输入:ruby --version
4、python 程序
命令行中输入:python -V
5、安装node.js
下载链接:https://nodejs.org/en/ 下载LTS版本,
执行安装命令:curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
6、安装brew
命令:/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
7、安装Android studio
Android studio 自带SDK 他自己下载sdk
验证Android studio 环境adb命令:adb devices
8、配置Android环境变量
在 ~/.bash_profile文件中添加path
export ANDROID_HOME=~/Library/Android/sdk/
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home #jdk安装路径
export PATH=~/bin:$PATH:/usr/local/bin:$ANDROID_HOME/platform-tools/:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
9、下载appium地址:https://github.com/appium/appium-desktop/releases
10、安装appium客户端安装包
11、安装appium服务端:npm install -g appium
12、安装appium-doctor
npm install -g appium-doctor
注意:出现这个问题不要慌 这个是因为权限问题
输入:PC-0080:~ guokr$ sudo chmod -R 777 /usr/local 权限问题就解决了
13、安装语言依赖
比如python语言
安装Appium-Client,python的话可使用pip安装:pip install Appium-Python-Client
如果报错 处理:
安装Python3(使用Python2跳过):
brew install python3
检测安装成功:pip3 -V
在输入:pip3 install Appium-Python-Client这个命令
14、然后用appium-doctor来检测我们的所有的自动化环境
13、安装其他依赖
brew install libimobiledevice --HEAD
npm install -g ios-deploy-----这个我没有安装成功 谁成功可以教我怎么弄得,不胜感激
brew install carthage
brew install ideviceinstaller # 安装app使用
在iOS10需要使用 ios-deploy
cnpm install -g ios-deploy
对真机需要xcpretty
gem install xcpretty
gem 安装速度慢可以更换镜像源
gem sources --add https://gems.ruby-china.org/ --remove https://rubygems.org/
需要有权限
libimobiledevice / ideviceinstaller 库:相当于 android 的 adb,是 Appium 底层用到的工具之一,用于获取 iOS 设备信息
ios-deploy:查看设备应用
carthage:类似于 java 的 maven,项目依赖管理,主要是 WebDriverAgent 使用
14、安装appium,在appium的configurations里设置
在Android_home中是sdk安装路径
15、下载xcode---安装后 可以直接打开,也可以用以下方法
配置WebDriverAgent
(1)首先进入WebDriverAgent所在文件目录下:
/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent
(2)根目录下执行:
./Scripts/bootstrap.sh
(3)打开WebDriverAgent.xcodeproj工程文件
(4)添加自己的account:Xcode -> Preferences -> account -> 左下角 +
更改bundle id:这里的bundle id就相当于一个App的唯一识别号,更改的规则随意,只要确认不会与有重复即可;所有的targets都需要修改。
验证是否环境已经安装成功了
(1)终端输入:appium-doctor
如果环境都已配置好,应该是文章最开始图片中的结果。
(2)运行WebDriverAgentRunner
按照图中,1:选择scheme为WebDriverAgentRunner -> 2:选择运行设备,模拟器和真机都可以 -> 3:选择要构建的方式 ->4:选择Test方式的步骤验证是否能成功运行,WebDriverAgentRunner
如果真机运行后弹出需要在设置中信任证书。
Verify the Developer App certificate for your account is trusted on your device. Open Settings on iPhone and navigate to General -> Device Management, then select your Developer App certificate to trust it.
按照步骤操作后,重新运行就可以了。