replay icon indicating copy to clipboard operation
replay copied to clipboard

PuppeteerRunnerExtension requirnig browser and page is cumbersome

Open steren opened this issue 2 years ago • 10 comments

This module can simply be used by calling one method (createRunner), however, to customize the behavior, one needs to create an PuppeteerRunnerExtension, and this one requires passing browser and page.

for simplicity, it would be better if an Extension would not requiring these, but would inherit the ones that I assume are created by createRunner

Expected Behavior

const runner = await createRunner(recording, new Extension() );

Actual Behavior

const browser = await puppeteer.launch({
  headless: true,
});

const page = await browser.newPage();

const runner = await createRunner(recording, new Extension(browser, page, 7000) );

steren avatar Jun 20 '22 23:06 steren

Hey @steren, thanks for the feedback. Do you have a suggestion on how we could achieve this? const runner = await createRunner(recording, new Extension() ); looks nice but createRunner is not able to determine if the puppeteer Browser and Page instances have to be created for this particular extension.

OrKoN avatar Jun 21 '22 13:06 OrKoN

I am not suggesting an implementation, I am suggesting an API surface.

When I do const runner = await createRunner(recording);, I do not have to pass any browser or page, this is why I do not expect to provide browser or page when I want to extend createRunner via a PuppeteerRunnerExtension

Could the extension get its browser and page from the one used by createRunner if not provided?

steren avatar Jun 22 '22 15:06 steren

Plus one to @steren comment. I think simplify this could further remove the barrier of entry, and help developers to make sense of the api (not everyone familiar with pptr browser) and getting started quicker.

How about make the params optional? Supporting both:

// use default setting, same as await createRunner(recording);
const runner = await createRunner(recording, new Extension());

// advance customization
const runner = await createRunner(recording, new Extension(browser, page, 7000) );

jecfish avatar Aug 21 '22 08:08 jecfish

Extension

cklim647 avatar Jul 12 '23 00:07 cklim647

Also it would make more sense to pass the browser and page to the createRunner method. You might not want to create a new Extension but want to provide a browser instance.

pbkompasz avatar Jul 27 '23 18:07 pbkompasz

commented

Ok

nyeary48 avatar Aug 07 '23 21:08 nyeary48

Bullhockey

nyeary48 avatar Aug 07 '23 21:08 nyeary48

Dumbdunns

nyeary48 avatar Aug 07 '23 21:08 nyeary48

@

lckin89 avatar Aug 26 '23 16:08 lckin89

For someone that is creating a new web browser as a beginner how do you suggest an API

Cookie838 avatar Dec 16 '23 17:12 Cookie838