安装应用程序 v1.6

Install appium v1.6

Appium 已发布最新版本的 appium v​​1.6,但图形应用程序的 .dmg 尚未发布。克隆 appium 的 git 存储库提供 beta 版本并且不修复 .bashprofile path/environment 变量等。如何安装要从 terminal/console 使用的 appium 最新版本 1.6?

注意:Copy/Pasting 来自 appium's official installation instructions page 和必要的 modifications/additions(用于安装 appium-doctor、carthage、grunt/grunt-cli 以及更重要的 appium)

注意 2:此答案是关于从 terminal/console 安装 appium v​​1.6。 v1.6 的图形应用程序尚未发布,因为此版本 1.6 最近发布,但希望图形应用程序也将很快可用。

所有这些命令都应该在 terminal/console 上 运行。在 Mac 上测试了这些步骤。如果它适用于 windows/ubuntu/etc,请在下方评论。太

安装 Ruby 的最新稳定版本。

curl -sSL https://get.rvm.io | bash -s stable
rvm install ruby

确保 RVM 默认使用正确的 Ruby

rvm list
rvm --default use 2.1.1

如果你有旧的ruby/rvm,你可以升级

rvm get head
rvm autolibs homebrew
rvm install ruby (this will take longer if rvm starts compiling ruby for your system)

通过打印 ruby 版本检查它是否安装正确。

ruby --version

更新 RubyGems 和 Bundler。

gem update --system
gem install --no-rdoc --no-ri bundler
gem update
gem cleanup

检查 RubyGems >= 2.1.5

gem --version

安装appium_consolegem.

gem uninstall -aIx appium_lib
gem uninstall -aIx appium_console
gem install --no-rdoc --no-ri appium_console

安装片状 gem。

gem uninstall -aIx flaky
gem install --no-rdoc --no-ri flaky

安装 brew

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

使用 brew 安装 nodejs。 不要使用 nodejs.org 网站上的绿色大安装按钮 否则所有 npm 命令都需要 sudo(并且 mac 不允许 "sudo npm ...")

brew update
brew upgrade node 

如果你的系统还没有使用 brew 的节点,上面的命令会说类似 "can't update because not installed" 的内容。在那种情况下不用担心。继续下面的安装命令

brew install node

节点应为 v4 或更高版本。

node --version
npm --version

大多数人的可选部分 如果您没有使用像 IntelliJ 或 Eclipse 这样的 ide 来构建 Maven 项目,那么: 如果尚未安装,请安装 ant/maven。 安装 maven 3.1.1 或更高版本。老行家不会工作。您可以使用命令

检查 ant 和 maven 的版本
ant -version
mvn -version

[可选部分到此结束:)]

现在,使用 npm 安装 appium

npm install -g appium 

安装 g运行t.

npm install -g grunt

将工作目录更改为 appium 文件夹。然后是运行g运行t版本命令。如果您不在该文件夹中,则不会显示 g运行t 版本。

cd /usr/local/lib/node_modules/appium (appium path on MacOS when installed via npm -g as above)
grunt --version

它应该像这样打印 g运行t 和 g运行t-cli 的版本

grunt-cli vX.Y.Z
grunt vA.B.C

要使用 iOS 进行测试,您需要授权-ios。如果您只是测试 Android,可以跳过此步骤。

npm install -g authorize-ios

运行 授权-ios 允许 appium 将 install/uninstall 正在测试的应用程序连接到您的目标设备

authorize-ios (this will ask you for system password. Enter it )

如果您正在测试 iOS 9.3 及更高版本(如最新的 iOS 10.0),那么您还需要 carthage。

npm install -g carthage

现在,安装 appium-doctor,它检查 ios 和 android 自动化的依赖关系。

npm install -g appium-doctor

运行 appium-doctor 命令查看哪些依赖项不是 installed/fixed。

appium-doctor (this will tell state of dependencies for andorid and ios both)
appium-doctor --ios (check only for ios dependencies )
appium-doctor --android (check only for android dependencies )

如果有任何未修复的依赖项(依赖项描述前显示红色叉号),appium 服务器将无法正常工作。因此,您应该修复您要 运行 测试的平台 (ios/android) 的依赖关系。

终于启动appium

appium (run this from terminal whenever you need to launch appium server next time)

现在 appium 服务器将准备好接受客户端的请求。

[Appium] Welcome to Appium v1.6.0
[Appium] Appium REST http interface listener started on 0.0.0.0:4723

现在 运行 你的测试,如果你已经写好了,或者访问 appium 的网站学习为 android/ios.

编写测试