Skip to content

ColdDay/touchRobot

Repository files navigation

touchRobot

机器模拟移动端触碰点击,手指滑动

Install

NPM

npm install touch-robot
import touchRobot from 'touch-robot';

CDN

<script type="text/javascript" src="./dist/touch-robot.min.js"></script>

Usage

var robot = new touchRobot(dom);

robot.touchLeft();

API

方法(method) 描述(description)
touchLeft 左滑
touchRight 右滑
touchTop 上滑
touchBottom 下滑
touchTo 定点滑动,参数startX,startY,endX,endY
touchClick 触碰点击

DEMO

demo

操作步骤

step1
    将代码在控制台粘贴执行
step2
    var robot = new touchRobot(document.querySelector('#btn'));
    robot.touchTo(0,0,400,0);

demo

操作步骤

step1
    将代码在控制台粘贴执行
step2
    var robot = new touchRobot(document.querySelector('.swiper-container'))
    robot.touchLeft()

Releases

No releases published

Packages

No packages published