///
import { Viewport } from 'puppeteer-core';
import ElementHandle from './Element';
export interface LaunchOptions {
headless?: boolean;
devtools?: boolean;
defaultViewport?: null | Viewport;
args?: string[];
ignoreDefaultArgs?: boolean | string[];
}
/**
* web 操控类
*/
export default class WebHandler {
/**
* 初始化参数
*/
launchOptions: object;
/**
* 是否开启设备模拟
*/
emulate: boolean;
/**
* 设备
*/
model: string;
/**
* 浏览器路径
*/
browserPath: string;
/**
* browser 实例
*/
browser: any;
/**
* page 实例
*/
page: any;
/**
* 屏幕尺寸
*/
screenSize: object | null;
/**
* Web Operator
*
* @param {string} browserPath 浏览器地址,默认使用 chromium 地址
*/
constructor(browserPath: string);
/**
* init 参数处理
*
* @param launchOptions LaunchOptions
*/
checkInitOptions(launchOptions?: LaunchOptions): void;
/**
* init Web operator
*
* @param {boolean} headless 是否采用无头方案
* @param {boolean} devtools 是否启用调试工具
* @param {array{object}} cookies 需要设置的 cookies
* @param {string} emulate 是否开启设备模拟
* @param {object} headers headers
*/
init(launchOptions?: LaunchOptions, cookies?: object[], emulate?: boolean, headers?: object): Promise;
/**
* 通过 xpath 获取元素操作对象列表
*
* @param {string} expression XPath表达式
* @returns {Promise>}
*/
$x(expression: string): Promise;
/**
* 通过 CSS 选择器获取元素操作对象
*
* @param selector CSS 选择器
* @returns {Promise}
*/
$(selector: string): Promise;
/**
* 通过 CSS 选择器获取元素操作对象列表
*
* @param selector CSS 选择器
* @returns {Promise>}
*/
$$(selector: string): Promise;
/**
* 屏幕点击
*
* @param {number} x 横坐标
* @param {number} y 纵坐标
* @return
*/
tap(x: number, y: number): Promise;
/**
* 页面滑动
*
* @param {number} fx 起点横坐标
* @param {number} fy 起点纵坐标
* @param {number} tx 终点横坐标
* @param {number} ty 终点纵坐标
*/
swipe(fx: number, fy: number, tx: number, ty: number): Promise;
/**
* 跳转 HTTP 地址
*
* @param {string} path url 路径
* @returns {string}
*/
goto(path?: string): Promise;
/**
* 获取页面宽高
*
* @return {object} screenSize
* @return {number} screenSize.width 宽度,单位是像素
* @return {number} screenSize.height 高度,单位是像素
*/
getScreenSize(): Promise