checkly / headless-recorder

Chrome extension that records your browser interactions and generates a Playwright or Puppeteer script.
https://checklyhq.com/headless-recorder
MIT License
15.03k stars 722 forks source link

Does not always record goto action #35

Closed scambra closed 5 years ago

scambra commented 5 years ago

When a start recording, type url and press enter, I get goto and navigation actions sometimes, but I just get navigation action most of times. So most of time I get a script which doesn't work because it isn't load an URL:

const puppeteer = require('puppeteer');
(async () => {
  const browser = await puppeteer.launch()
  const page = await browser.newPage()

  const navigationPromise = page.waitForNavigation()

  await navigationPromise

  ....

  await browser.close()
})()

Sometimes I get right script:

const puppeteer = require('puppeteer');
(async () => {
  const browser = await puppeteer.launch()
  const page = await browser.newPage()

  const navigationPromise = page.waitForNavigation()

  await page.setViewport({ width: 1920, height: 906 })

  await page.goto('URL')

  await navigationPromise

  ....  

  await browser.close()
})()
tnolet commented 5 years ago

@scambra this behaviour can happen if a page has not properly loaded yet, or there are multiple tabs and the correct tab is not focused. Mostly, this problem goes away if you let the page load completely finish.

scambra commented 5 years ago

I can't get it working right everytime, but I can't reproduce it everytime, it works sometimes, and fails sometimes too.

I open blank tab, click record, type url, wait for icon changing from wait to rec, then click on extension icon and I don't see goto step. Click stop, restart and start recording again, refresh tab and wait for rec status, and now I can see goto step.

Then, I tried to load url before recording, click record, refresh tab but I didn't get goto step. After, stop, restart and start recording again, I refresh tab and I get goto step.

So, I'm thinking only second record on same tab gets goto step.