Installing appium in Mac environment for App UI automation test

Dependent environment:

  • java
✗ java -version
java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)
  • python
$python --version
Python 3.6.4
  • node.js
$node -v
v10.6.0
 If not, install with the following command:
$brew install node
  • android sdk and environment configuration (there are many on the Internet, which will not be repeated here)
$adb
Android Debug Bridge version 1.0.39
Revision 3db08f2c6889-android
Installed as /Users/xxx/Android/sdk/platform-tools/adb

global options:
 -a         listen on all network interfaces, not just localhost
 -d         use USB device (error if multiple devices connected)
 -e         use TCP/IP device (error if multiple TCP/IP devices available)
 -s SERIAL
...
  • Appium

There are two ways to install Appium,
1. go straight ahead. Official website Download dmg installation package
2. Command line installation (also officially provided) (the installation process is a little slow, wait patiently)

> brew install node      # get node.js
> npm install -g appium  # get appium
> npm install wd         # get appium client
> appium &               # start appium

When installing appium, i.e. executing npm install -g appium, some warning s will appear, just ignore. Similar to the following

/Users/xxx/.node-gyp/10.6.0/include/node/v8.h:7354:3: note: 'GetCpuProfiler' has been explicitly marked deprecated here
  V8_DEPRECATED("CpuProfiler should be created with CpuProfiler::New call.",
  ^
/Users/xxx/.node-gyp/10.6.0/include/node/v8config.h:327:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated))
                            ^
../src/heapdump.cc:106:23: warning: 'Utf8Value' is deprecated [-Wdeprecated-declarations]
    String::Utf8Value filename_string(args[0]);
                      ^
/Users/xxx/.node-gyp/10.6.0/include/node/v8.h:2851:5: note: 'Utf8Value' has been explicitly marked deprecated here
    V8_DEPRECATED("Use Isolate version",
    ^

After installation, test whether the installation is successful.

$appium -v
1.8.1

Start appium service

Appium or appium &.

$appium  
(node:39581) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
[Appium] Welcome to Appium v1.8.1
[Appium] Appium REST http interface listener started on 0.0.0.0:4723

Close the appium service.

  • If you use appium to start the service, you can directly cmd+c to force the service to shut down:
$appium
(node:40425) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
[Appium] Welcome to Appium v1.8.1
[Appium] Appium REST http interface listener started on 0.0.0.0:4723

^C[Appium] Received SIGINT - shutting down
  • If you use appium & to start the service, cmd+c is invalid. You can see the difference from the above method, and you will not receive the shut down instruction, that is, Received SIGINT - shutting down. At this time, the service is still running. If it is restarted, an error is reported as follows:
$appium &         
[1] 40481
$ (node:40481) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
[Appium] Welcome to Appium v1.8.1
[Appium] Appium REST http interface listener started on 0.0.0.0:4723

$appium
(node:40574) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
[Appium] Welcome to Appium v1.8.1
[HTTP] Could not start REST http interface listener. The requested port may already be in use. Please make sure there is no other instance of this server running already.
Fatal Error: listen EADDRINUSE 0.0.0.0:4723
    at Server.setupListenHandle [as _listen2] (net.js:1335:14)
    at listenInCluster (net.js:1383:12)
    at doListen (net.js:1509:7)
    at process._tickCallback (internal/process/next_tick.js:63:19)

At this point, you need to force kill service, use ps to get the appium service process, and then kill:

$ps | grep appium
40481 ttys002    0:02.00 node /usr/local/bin/appium
40668 ttys002    0:00.00 grep --color appium
$kill -9 40481
[1]  + 40481 killed     appium

More blogs, please follow
https://blog.csdn.net/rflyee/
https://www.jianshu.com/u/ff8bcd76e5a7

Keywords: Java Android REST Python

Added by gwh on Sat, 15 Feb 2020 21:15:00 +0200