如何在 Ubuntu 中为 android 设置 Appium
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22374416/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to setup Appium in Ubuntu for android
提问by Deepak
I am new in appium
(automation testing technology).
我是appium
(自动化测试技术)新手。
I'm using a PC running Ubuntu Linux.
我正在使用运行 Ubuntu Linux 的 PC。
I have searched about this topic but I have not got any useful tutorial. Can anyone point me to the right documentation?
我已经搜索过这个主题,但没有任何有用的教程。谁能指出我正确的文档?
回答by deepak
Do not install nodejs through apt-get, which will need sudo rights and appium will not work if node is installed as sudo user. If you have already installed remove it using
不要通过 apt-get 安装 nodejs,这需要 sudo 权限,如果 node 安装为 sudo 用户,appium 将无法运行。如果您已经安装,请使用删除它
sudo apt-get remove nodejs
sudo apt-get remove npm
Download latest nodejs linux binariesform http://nodejs.org/download/
从http://nodejs.org/download/下载最新的 nodejs linux 二进制文件
Extract into a folder that doesn't need sudo rights to access, for example your home folder.
解压到不需要 sudo 权限即可访问的文件夹中,例如您的主文件夹。
tar -xvf <downloaded_binary_tar.gz>
Add the following line to your ~/.bashrc file.
将以下行添加到您的 ~/.bashrc 文件中。
export PATH=$PATH:<full_path_of_the_extracted_node_folder>/bin
Open a now terminal and do
打开一个 now 终端并执行
npm install -g appium
appium
回答by plosco
I'm sure you will find plenty of tutorials on this (and this will only work for android since you would need an OSX box to do iOS) but here is what we did:
我相信你会找到很多关于这方面的教程(这仅适用于 android,因为你需要一个 OSX 盒子来做 iOS)但这是我们所做的:
sudo apt-get update
sudo apt-get install -y python-software-properties python g++ make
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
UPDATE: use homebrew to install node
sudo apt-get update
sudo apt-get install -y python-software-properties python g++ make
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
更新:使用自制软件安装节点
npm install -g grunt-cli
If you run into an issue about it not being able to install in a directory, do this.
如果您遇到无法在目录中安装的问题,请执行此操作。
npm install -g appium
Set up a symlink in your .bashrc
file for Appium:
在你的.bashrc
文件中为 Appium设置一个符号链接:
ln -s /path/to/appium.js /usr/bin/appium
Test to make sure it can run by running appium
in your terminal. The output should be something like:
通过appium
在终端中运行来测试以确保它可以运行。输出应该是这样的:
info: Welcome to Appium v0.16.0 (REV 292d265edd9c7aaf96f165009285c814b218363d)
info: Appium REST http interface listener started on 0.0.0.0:4723
info - socket.io started
sudo apt-get install openjdk-6-jre
Download the SDKand extract it to your home folder.
下载SDK并将其解压缩到您的主文件夹。
Launch the Android SDK Manager:
启动 Android SDK 管理器:
~/path/to/android-sdk/tools/android
Install the packages that you'll need in the new window:
在新窗口中安装您需要的软件包:
- Android 4.X
- Android Support Library
- Android SUpport Repository
- Google Play services
- Everything under Tools
- Everything under Extras
- 安卓 4.X
- 安卓支持库
- Android 支持存储库
- 谷歌播放服务
- 工具下的所有内容
- 附加项下的所有内容
You can also create a symlink for the Android SDK Manager by doing:
您还可以通过执行以下操作为 Android SDK 管理器创建符号链接:
ln -s /path/to/android-sdk/tools/android /usr/bin/android
回答by krishna chetan
Steps to get appium working on ubuntu pc :
在 ubuntu pc 上运行 appium 的步骤:
Install ruby: Paste the below command at terminal and hit enter
安装 ruby:在终端粘贴以下命令并回车
sudo apt-get install build-essential curl git m4 ruby texinfo libbz2-dev libcurl4-openssl-dev libexpat-dev libncurses-dev zlib1g-dev
Install linux brew:Paste the below command at terminal and hit enter
安装 linux brew:在终端粘贴以下命令并回车
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/linuxbrew/go/install)"
set path for brew
设置 brew 的路径
Type: gedit .bashrc at terminal and copy paste following into the .bashrc file
在终端输入:gedit .bashrc 并将以下内容复制粘贴到 .bashrc 文件中
export PATH="$HOME/.linuxbrew/bin:$PATH"
export MANPATH="$HOME/.linuxbrew/share/man:$MANPATH"
export INFOPATH="$HOME/.linuxbrew/share/info:$INFOPATH"
Install node:Paste the below commands one by one at terminal and hit enter
安装节点:将以下命令一一粘贴到终端并回车
brew update
brew install node
brew link node
Install appium
安装 appium
npm install -g appium
npm install wd
To start appium: Paste the below command at terminal and hit enter
要启动 appium:在终端粘贴以下命令并按 Enter
appium
回答by user2220762
Steps to install Appium on Linux.
在 Linux 上安装 Appium 的步骤。
Basics setup from the link.
来自链接的基本设置。
Now install linuxbrew taking help from the link.
现在从链接中获取帮助安装 linuxbrew 。
Now use the following commands from the terminal
现在从终端使用以下命令
Make sure to start a new terminal:
确保启动一个新终端:
brew update
brew install node
brew link node
npm install -g appium@version
Hope this helps those who face the issue installing with "sudo".
希望这可以帮助那些遇到使用“sudo”安装问题的人。
回答by olyv
Just to save somebodies time: on my Ubuntu 14.04 I was trying to install npm both via sudo apt-get and using binaries. Both approaches were wrong but everything is Ok after I istalled npm via HomeBrew
只是为了节省一些人的时间:在我的 Ubuntu 14.04 上,我试图通过 sudo apt-get 和使用二进制文件安装 npm。两种方法都是错误的,但在我通过HomeBrew安装 npm 后一切正常
回答by anuja jain
Many people face issue while installing appium on ubuntu because we install using sudo we should install appium using npm
许多人在 ubuntu 上安装 appium 时遇到问题,因为我们使用 sudo 安装我们应该使用 npm 安装 appium
Detailed step by step explanation to install appium on Ubuntu using npm
使用 npm 在 Ubuntu 上安装 appium 的详细分步说明
To install node.js and appium without sudo we use linuxbrew.
To install linuxbrew these are the dependencies
Ruby 1.8.6 or newer GCC 4.2 or newer Git 1.7.12.4 or newer Linux 2.6.16 or newer 64-bit x86 or 32-bit ARM platform
Install Ruby using below command
sudo apt-get install build-essential curl git m4 python-setuptools ruby texinfo libbz2-dev libcurl4-openssl-dev libexpat-dev libncurses-dev zlib1g-dev
Install Linux Brew using below command
ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/linuxbrew/go/install)"
Set Path for brew
要在没有 sudo 的情况下安装 node.js 和 appium,我们使用 linuxbrew。
要安装 linuxbrew,这些是依赖项
Ruby 1.8.6 or newer GCC 4.2 or newer Git 1.7.12.4 or newer Linux 2.6.16 or newer 64-bit x86 or 32-bit ARM platform
使用以下命令安装 Ruby
sudo apt-get install build-essential curl git m4 python-setuptools ruby texinfo libbz2-dev libcurl4-openssl-dev libexpat-dev libncurses-dev zlib1g-dev
使用以下命令安装 Linux Brew
ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/linuxbrew/go/install)"
设置酿造路径
first type sudo gedit.bashrc
in terminal and copy the below in the .bashrc file.export
首先输入sudo gedit.bashrc
终端并复制以下内容.bashrc file.export
PATH="$HOME/.linuxbrew/bin:$PATH"exportMANPATH="$HOME/.linuxbrew/share/man:$MANPATH"export INFOPATH="$HOME/.linuxbrew/share/info:$INFOPATH"
PATH="$HOME/.linuxbrew/bin:$PATH"exportMANPATH="$HOME/.linuxbrew/share/man:$MANPATH"export INFOPATH="$HOME/.linuxbrew/share/info:$INFOPATH"
7 .Install Node:Open new terminal and copy the command and press enter
7 .Install Node:打开新终端并复制命令并按回车
brew update
brew install node
brew link node
8.Finally Install Appium using below command
8.最后使用以下命令安装Appium
npm install -g appium
9.Let's Check if the installation is successfull. Open the terminal and type "appium" and hit enter.You should see something like this in the terminal
9.让我们检查是否安装成功。打开终端并输入“appium”并回车。您应该在终端中看到类似这样的内容
info: Welcome to Appium v1.4.12(REV 8db2d00b9afcf2c50a09a80a2e8d56b05a902caf)
info: Appium REST http interface listener started on 0.0.0.0:4723
info: Console LogLevel: debug
回答by Raja Rama Mohan Thavalam
It is very simple and easy, Please check the below steps!.
非常简单容易,请检查以下步骤!。
1) Install latest Node.js
1) 安装最新的 Node.js
Terminal commands:
终端命令:
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
More information please check official website.
更多信息请查看官网。
2) Install latest Appium
2) 安装最新的 Appium
Terminal commands :
终端命令:
npm install -g appium
or
或者
sudo npm install -g appium
More information please check official documentation.
更多信息请查看官方文档。
回答by abishek kachroo
I can tell about the 14.04 version
我可以说说 14.04 版本
- Download the file from https://nodejs.org/en/
2.Now for extracting the file path press Ctrl+l , it will give the exact path , copy it
2.现在提取文件路径按Ctrl + l,它会给出确切的路径,复制它
3.open bash.src file and it has to be open with gedit, this file is hidden Press Ctrl+h to see the hidden files
3.打开bash.src文件,必须用gedit打开,这个文件是隐藏的 按Ctrl+h查看隐藏文件
4.now in the bash.src file,paste the below commands
4.现在在bash.src文件中,粘贴以下命令
export PATH=$PATH:"somepath u copied upto bin"
export NODE_PATH=$PATH:"somepath u copied upto bin node_modules'"
It will surely work
它肯定会工作
回答by Marcus Paulo
I've installed the NVM on CentOS 7
and it works perfectly.
我已经安装了 NVM CentOS 7
,它运行良好。
curl https://raw.githubusercontent.com/creationix/nvm/v0.13.1/install.sh | bash
I will strongly recommend going for that with which you will have control of NodeJS
versions.
我强烈建议您选择可以控制NodeJS
版本的方法。
Btw, Linuxbrew
doesn't work for me.
顺便说一句,Linuxbrew
对我不起作用。