Sesame HTTP: Installation of Appium

Appium is an automated testing tool for mobile terminals, similar to the aforementioned Selenium. It can be used to drive Android, iOS and other devices to complete automated testing, such as simulating operations such as clicking, sliding, and input. Its official website is: http://appium. io/ . In this section, let's take a look at how Appium is installed.

1. Related Links

2. Install Appium

First, Appium needs to be installed. Appium is responsible for driving the mobile terminal to complete a series of operations. For iOS devices, it uses Apple's UIAutomation to implement the driver; for Android, it uses UIAutomator and Selendroid to implement the driver.

At the same time, Appium is also equivalent to a server, we can send some operation instructions to it, and it will drive the mobile device according to different instructions to complete different actions.

There are two ways to install Appium, one is to directly download the installation package Appium Desktop to install, and the other is to install it through Node.js. Let's introduce these two installation methods.

Appium Desktop

Appium Desktop supports the installation of all platforms. We can install it directly from GitHub's Releases. The link is https://github.com/appium/appium-desktop/releases . The current latest version is 1.1, and the download page is shown in the figure.

The Windows platform can download the exe installation package appium-desktop-Setup-1.1.0.exe, the Mac platform can download the dmg installation package such as appium-desktop-1.1.0.dmg, the Linux platform can choose to download the source code, but it is more recommended to use Node. js installation method.

After the installation is complete, run it, and the page you see is shown in the figure.

If this page appears, the installation was successful.

Node.js

First, you need to install Node.js. For the specific installation method, see http://www.runoob.com/nodejs/nodejs-install-setup.html . After the installation is complete, you can use npmthe command.

Next, npminstall Appium globally with the command:

npm install -g appium

 At this point, you can wait for the command execution to complete, so that Appium is successfully installed.

3. Android development environment configuration

If we want to use an Android device for App grabbing, we also need to download and configure the Android SDK. It is recommended to install Android Studio directly. The download address is https://developer.android.com/studio/index.html?hl=zh -cn . You can install it directly after downloading.

Then, we also need to download the Android SDK. Directly open the Android SDK settings page in the preferences, check the SDK version to be installed, and click the OK button to download and install the checked SDK version, as shown in the figure.

另外,还需要配置一下环境变量,添加ANDROID_HOME为Android SDK所在路径,然后再添加SDK文件夹下的tools和platform-tools文件夹到PATH中。

更详细的配置可以参考Android Studio的官方文档:https://developer.android.com/studio/intro/index.html

4. iOS开发环境

首先需要声明的是,Appium是一个做自动化测试的工具,用它来测试我们自己开发的App是完全没问题的,因为它携带的是开发证书(Development Certificate)。但如果我们想拿iOS设备来做数据爬取的话,那又是另外一回事了。一般情况下,我们做数据爬取都是使用现有的App,在iOS上一般都是通过App Store下载的,它携带的是分发证书(Distribution Certificate),而携带这种证书的应用都是禁止被测试的,所以只有获取ipa安装包再重新签名之后才可以被Appium测试,具体的方法这里不再展开阐述。

这里推荐直接使用Android来进行测试。如果你可以完成上述重签名操作,那么可以参考如下内容配置iOS开发环境。

Appium驱动iOS设备必须要在Mac下进行,Windows和Linux平台是无法完成的,所以下面介绍一下Mac平台的相关配置。

Mac平台需要的配置如下:

  • macOS 10.12及更高版本
  • XCode 8及更高版本

配置满足要求之后,执行如下命令即可配置开发依赖的一些库和工具:

xcode-select --install

 这样iOS部分的开发环境就配置完成了,我们就可以用iOS模拟器来进行测试和数据抓取了。

如果想要用真机进行测试和数据抓取,还需要额外配置其他环境,具体可以参考https://github.com/appium/appium/blob/master/docs/en/appium-setup/real-devices-ios.md

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326253352&siteId=291194637