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
}

Mac安装stf的更多相关文章

  1. Mac 之 STF 搭建(淘宝源安装)

    参考链接:https://www.jianshu.com/p/5fe8cb7d214f (MAC直接安装STF)https://www.jianshu.com/p/c5c298486dbd(homeb ...

  2. Mac上安装stf

    一,安装 STF的依赖比较多,如下: Node.js >= 0.12ADB properly set upRethinkDB >= 2.2GraphicsMagick (for resiz ...

  3. MAC 下 STF 的环境搭建和运行

    STF --WEB 端批量移动设备管理控制工具 安装各种包 (首先安装Macport,因为后面需要用到port:http://www.ccvita.com/434.html) linux的基本包安装, ...

  4. 【openstf】自己的云测平台——mac安装openstf

    openstf的github地址:https://github.com/openstf/stf 上图可以清晰看出openstf的使用场景和效果   openstf是一个web应用程序,用于远程调试智能 ...

  5. mac安装tensorflow报错

    问题:mac安装tensorflow过程中,爆出oserror:permission denied 解决方案:关闭mac的sip,然后sudo安装 关闭sip的方法:重启mac,按住command+R ...

  6. Mac 安装activate-power-mode atom

    Mac 安装activate-power-mode atom 标签: atommac 2015-12-02 14:53 308人阅读 评论(0) 收藏 举报  分类: git(2)  版权声明:本文为 ...

  7. Mac安装ctags

    Mac安装ctags mac 系统有自带的ctags,但是不支持"ctags -R"指令,需要自己在安装Exuberant Ctags 1.下载ctags 2. 安装 ./conf ...

  8. ubuntu 安装 swoole 和mac 安装swoole 扩展

    ubuntu php 安装swoole 比较容易 1. 从git下载源码 2. 下载pcre http://sourceforge.net/projects/pcre/files/pcre/8.36/ ...

  9. [Scrapy] Mac安装Scrapy

    Mac安装Scrapy Mac版本 10.11 El Captain. 前一段想在Mac上用Scrapy,各种问题.有一个不错的工具:Anaconda. 安装Anaconda 下载地址 我还是下pyt ...

随机推荐

  1. Java源码之HashMap的hash篇

    提到哈希,我们脑袋中立马就会闪过一个方法,就是hashCode(),没错.就是这个! 我们知道HashMap是通过 数组+链表 的结构进行数据存储的,有数组就会有索引,而HashMap内的数据要存储在 ...

  2. Python实现拆分多级目录的方式

    1 环境 操作系统:Windows10 Python版本:Python3.7 2 简介 实现多级目录差分,举例说明如下: 假设现有的目录结构如下:1.2.2.1.2.2.2.3.2.4.3.4.5.6 ...

  3. vim配置汇总

    目录 配置行号 显示状态栏 设置提示换行线 配置行号 set number 效果 显示状态栏 set laststatus=2 设置提示换行线 set colorcolumn=81

  4. 本机浏览器无法访问linux的tomcat

    原因:Centos7的防火墙拦截了tomcat访问的8080端口  Redhat 等等linux firewall-cmd --permanent --zone=public --add-port=8 ...

  5. Flutter学习一之环境搭建

    MacOS上搭建Flutter开发环境 1.flutter官网下载最新的安装包,https://flutter.io/sdk-archive/#macos 2.解压安装包到你想安装的目录.直接解压或者 ...

  6. python爬取酷狗音乐

    url:https://www.kugou.com/yy/html/rank.html 我们随便访问一个歌曲可以看到url有个hash https://www.kugou.com/song/#hash ...

  7. python与Oracle

    1.python 3.6.6 2.使用cx_Oracle      -----------安装方法:pip install cx_Oracle 3.游标 cursor -----游标是系统为用户开创的 ...

  8. Codeforces Round #673 (Div. 2)

    [Codeforces Round #673 (Div. 2) ] 题目链接# A. Copy-paste 思路: 贪心的策略.每次只加上最小的就可以了 #include<bits/stdc++ ...

  9. mapreduce的一些简单使用

    一.键值对RDD的创建 1.从文件中加载 /opt目录下创建wordky.txt文件. wordky.txt文件中输入以下三行字符: Hadoop is good Spark is fast Spar ...

  10. P2947 Look Up S

    题目描述: 约翰的N(1≤N≤10^5)头奶牛站成一排,奶牛i的身高是Hi(l≤Hi≤1,000,000).现在,每只奶牛都在向右看齐.对于奶牛i,如果奶牛j满足i<j且Hi<Hj,我们可 ...