1.0.6 • Published 4 years ago

puppeteer-sikuli v1.0.6

Weekly downloads
30
License
MIT
Repository
github
Last release
4 years ago

puppeteer-sikuli

puppeteer简单图片识别 图像识别使用matches-subimage,并增加了typescript支持

API

  • pixelmatch(page: puppeteer.Page, path: string, options?: any) —— 传入puppeteer的page示例, 以及需要在页面中匹配的子图像的图片文件路径。
  • options —— 可选参数
    • threshold —— 匹配精确度, 范围从0 - 1。0精确,1模糊,默认值为0.1。
    • screenshotOption —— 参考puppeteer的screenshot参数

使用示例

// 输入puppeteer的Page实力实例与图片路径, 获取图片在页面中的位置

cosnt {x, y} = await pixelmatch(page: puppeteer.Paeg, path: string)

await page.mouse.click(x, y);

// 或

await touchscreen.tap(x, y)