Touchscreen
Touchscreen 类在相对于视口左上角的主框架 CSS 像素中运行。触摸屏上的方法只能在已将 hasTouch
设置为 true 的情况下初始化的浏览器上下文中使用。
¥The Touchscreen class operates in main-frame CSS pixels relative to the top-left corner of the viewport. Methods on the touchscreen can only be used in browser contexts that have been initialized with hasTouch
set to true.
方法
¥Methods
tap
Added in: v1.8在位置 (x
,y
) 处单击一次即可调度 touchstart
和 touchend
事件。
¥Dispatches a touchstart
and touchend
event with a single touch at the position (x
,y
).
注意
如果浏览器上下文的 hasTouch
选项为 false,则 page.tap() 该方法将抛出异常。
¥page.tap() the method will throw if hasTouch
option of the browser context is false.
用法
¥Usage
await touchscreen.tap(x, y);
参数
¥Arguments
返回
¥Returns