1.brew install rethinkdb graphicsmagick zeromq protobuf yasm pkg-config

2.node版本8.x我的是8.15.0

3.npm install -g stf 或者cnpm install -g stf

4.后天启动数据库:nohup rethinkdb &

5.启动STF的客户端:stf local --public-ip 本机IP --allow-remote

例如:stf local --public-ip 192.168.1.102 --allow-remote

在浏览器访问:http://192.168.0.101:7100/

6.常用的接口脚本

#!/usr/bin/env bash
STF_TOKEN=4df3f1f8232d459aa83a4ffb15ed1d44695868e40fc7462892adc5ea0ac19d63
#STF_URL=http://39.105.132.200:7100
STF_URL=http://127.0.0.1:7100
DEVICE_SERIAL="emulator-5554"
# 申请设备
function add_device() {
response=$(curl -X POST -H "Content-Type: application/json" \
-H "Authorization: Bearer $STF_TOKEN" \
--data "{\"serial\": \"$DEVICE_SERIAL\"}" $STF_URL/api/v1/user/devices) success=$(echo "$response" | jq .success | tr -d '"')
description=$(echo "$response" | jq .description | tr -d '"') if [ "$success" != "true" ]; then
echo "Failed because $description"
echo exit 1
fi echo "Device $DEVICE_SERIAL added successfully"
}
# 远程链接设备
function remote_connect() {
response=$(curl -X POST \
-H "Authorization: Bearer $STF_TOKEN" \
$STF_URL/api/v1/user/devices/$DEVICE_SERIAL/remoteConnect) success=$(echo "$response" | jq .success | tr -d '"')
description=$(echo "$response" | jq .description | tr -d '"') if [ "$success" != "true" ]; then
echo "Failed because $description"
echo exit 1
fi
remote_connect_url=$(echo "$response" | jq .remoteConnectUrl | tr -d '"')
echo $remote_connect_url adb connect $remote_connect_url echo "Device $DEVICE_SERIAL remote connected successfully"
}
# 移除设备
function remove_device() {
# 断开设备链接
adb disconnect $remote_connect_url
response=$(curl -X DELETE \
-H "Authorization: Bearer $STF_TOKEN" \
$STF_URL/api/v1/user/devices/$DEVICE_SERIAL) success=$(echo "$response" | jq .success | tr -d '"')
description=$(echo "$response" | jq .description | tr -d '"') if [ "$success" != "true" ]; then
echo "Failed because $description"
echo exit 1
fi echo "Device $DEVICE_SERIAL removed successfully"
}
function run_device() {
add_device
remote_connect
sleep 2
adb devices
remote_device=$remote_connect_url
java -jar /Users/anxiaodong/learn/appcrawler/appcrawler-2.4.0-jar-with-dependencies.jar \
-c /Users/anxiaodong/learn/appcrawler/xueqie.yml \
--capability "udid=${remote_device}, systemPort=1${remote_device#*:}, appPackage=com.xueqiu.android,appActivity=.view.WelcomeActivityAlias"
remove_device
}
function every_device() {
#获得可用设备列表
devices=$(curl -H "Authorization: Bearer $STF_TOKEN" $STF_URL/api/v1/devices | jq -r '.devices[] | select(.present==true)|.serial ')
for DEVICE_SERIAL in $devices; do
{
add_device
remote_connect
sleep 2
remote_device=$remote_connect_url
eval $1
adb disconnect $remote_device
sleep 2
remove_device
} &
done
}

最新文章

  1. Git使用命令
  2. 团队开发——冲刺2.d
  3. c# 支付宝查单补单
  4. fenshijin
  5. JavaScript学习笔记 - 进阶篇(1)- JS基础语法
  6. bzoj1832: [AHOI2008]聚会
  7. ios客户端base64上传图片到java服务器遇到的问题
  8. IPython,让Python显得友好十倍的外套——windows XP/Win7安装详解
  9. overflow:hidden
  10. tcp异常终止连接
  11. jQuery(function(){...})与(function($){...})(jQuery)的“兄弟”情结
  12. android离线缓存技术
  13. spring-aop 的注释用法
  14. 如何用TortoiseSVN对文件进行操作
  15. windows下elasticsearch6.X安装IK分词器
  16. day2编程语言的两大分类
  17. nginx 重定向与反向代理
  18. redis三种启动方式
  19. 一个有趣的异步时序逻辑电路设计实例 ——MFM调制模块设计笔记
  20. 深入理解javascript选择器API系列第三篇——HTML5新增的3种selector方法

热门文章

  1. oracle数据处理之逻辑备份与恢复
  2. [LeetCode]23. 合并K个排序链表(优先队列;分治待做)
  3. windows下nginx的配置
  4. Spring Cloud Alibaba微服务生态的基础实践
  5. Jenkins+Git+Gitlab+Ansible实现持续集成自动化部署静态网站(6)
  6. 【开发总结】order by 为什么没有走索引?
  7. 基于MAXIMO的发电行业EAM解决方案
  8. 我还在生产玩 JDK7,JDK 15 却要来了!
  9. java.lang.NoSuchMethodError: org.springframework.util.Assert.isTrue(ZLjava/util/function/Supplier;)V
  10. JMeter Websocket 二进制Binary压力测试或接口测试