jeudi 28 décembre 2017

how to use puppeteer mouse.click

I use puppeteer for testing UI.

I collect the coordinate then use mouse.click to simulate click event. But invalid!

I wrong ?

const puppeteer = require('puppeteer')

;(async () => {

  const browser = await puppeteer.launch({
    headless: false,
    slowMo: 20
  })

  const page = await browser.newPage()

  await page.goto('http://ift.tt/2C5tlVO')

  await page.waitFor(5000)

  await page.setViewport({
    width: 1400,
    height: 800
  })

  const m = page.mouse

  await m.click(50, 50)  // coordinate

  await page.waitFor(5000)

  await page.screenshot({path: 'test.png'});
  await browser.close();
})()

Aucun commentaire:

Enregistrer un commentaire