Mac安装stf
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的更多相关文章
- Mac 之 STF 搭建(淘宝源安装)
		参考链接:https://www.jianshu.com/p/5fe8cb7d214f (MAC直接安装STF)https://www.jianshu.com/p/c5c298486dbd(homeb ... 
- Mac上安装stf
		一,安装 STF的依赖比较多,如下: Node.js >= 0.12ADB properly set upRethinkDB >= 2.2GraphicsMagick (for resiz ... 
- MAC 下 STF 的环境搭建和运行
		STF --WEB 端批量移动设备管理控制工具 安装各种包 (首先安装Macport,因为后面需要用到port:http://www.ccvita.com/434.html) linux的基本包安装, ... 
- 【openstf】自己的云测平台——mac安装openstf
		openstf的github地址:https://github.com/openstf/stf 上图可以清晰看出openstf的使用场景和效果 openstf是一个web应用程序,用于远程调试智能 ... 
- mac安装tensorflow报错
		问题:mac安装tensorflow过程中,爆出oserror:permission denied 解决方案:关闭mac的sip,然后sudo安装 关闭sip的方法:重启mac,按住command+R ... 
- Mac 安装activate-power-mode atom
		Mac 安装activate-power-mode atom 标签: atommac 2015-12-02 14:53 308人阅读 评论(0) 收藏 举报 分类: git(2) 版权声明:本文为 ... 
- Mac安装ctags
		Mac安装ctags mac 系统有自带的ctags,但是不支持"ctags -R"指令,需要自己在安装Exuberant Ctags 1.下载ctags 2. 安装 ./conf ... 
- ubuntu 安装 swoole 和mac 安装swoole 扩展
		ubuntu php 安装swoole 比较容易 1. 从git下载源码 2. 下载pcre http://sourceforge.net/projects/pcre/files/pcre/8.36/ ... 
- [Scrapy] Mac安装Scrapy
		Mac安装Scrapy Mac版本 10.11 El Captain. 前一段想在Mac上用Scrapy,各种问题.有一个不错的工具:Anaconda. 安装Anaconda 下载地址 我还是下pyt ... 
随机推荐
- 高可用集群之keepalived+lvs实战2
			keepalived简介 lvs在我之前的博客<高负载集群实战之lvs负载均衡-技术流ken>中已经进行了详细的介绍和应用,在这里就不再赘述.这篇博文将把lvs与keepalived相结合 ... 
- Kubernetes中的Helm和修改证书有效时间(八)
			一.Helm的介绍 1,概念 Helm 把 k8s 资源(比如 deployments.services 或 ingress 等)打包到一个 chart 中,而 chart 被保存到 chart 仓库 ... 
- textarea输入框回车加大高度
			JavaScript var agt = navigator.userAgent.toLowerCase(); var is_op = (agt.indexOf("opera") ... 
- springmvc与mybatis整合时 java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required 异常
			今天在整合springmvc与mybatis时,启动服务器遇到这样一个问题, by: java.lang.IllegalArgumentException: Property 'sqlSessionF ... 
- Centos-退出抽取设备-eject
			eject 退出抽取设备,如光驱或磁带,如果设备已经挂载,则卸载设备 相关选项 -q 退出磁盘 -r 退出光盘 -d 显示默认设备 
- Docker系列——利用gogs搭建属于自己的git服务
			gogs简介 Gogs的目标是打造一个最简单.最快速和最轻松的方式搭建自助Git服务.使用Go语言开发使得Gogs能够通过独立的二进制分发,并且支持Go语言支持的所有平台,包括 Linux.Mac O ... 
- 在.NET中使用DiagnosticSource
			前言 DiagnosticSource是一个非常有意思的且非常有用的API,对于这些API它们允许不同的库发送命名事件,并且它们也允许应用程序订阅这些事件并处理它们,它使我们的消费者可以在运行时动态发 ... 
- matlab中的polyfit函数。
			来源:https://blog.csdn.net/zhaluo0051/article/details/77949170 :https://blog.csdn.net/g28_gwf/article/ ... 
- MATLAB鼠标事件
			来源:https://blog.csdn.net/weixin_39090239/article/details/80586930 前记: 人机交互的方式--键盘开关.鼠标.触摸屏.体感传感器(Kin ... 
- 步进电机的Arduino库函数
			This library allows you to control unipolar or bipolar stepper motors. To use it you will need a ste ... 
