Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PuppeteerRunnerExtension requirnig browser and page is cumbersome #201

Open
steren opened this issue Jun 20, 2022 · 10 comments
Open

PuppeteerRunnerExtension requirnig browser and page is cumbersome #201

steren opened this issue Jun 20, 2022 · 10 comments
Labels
enhancement New feature or request

Comments

@steren
Copy link

steren commented Jun 20, 2022

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) );
@OrKoN
Copy link
Collaborator

OrKoN commented Jun 21, 2022

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 OrKoN added needs-feedback enhancement New feature or request labels Jun 21, 2022
@steren
Copy link
Author

steren commented Jun 22, 2022

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?

@jecfish
Copy link
Contributor

jecfish commented Aug 21, 2022

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) );

@cklim647

This comment was marked as off-topic.

@pbkompasz
Copy link

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.

@nyeary48

This comment was marked as off-topic.

@nyeary48

This comment was marked as off-topic.

@nyeary48

This comment was marked as off-topic.

@lckin89

This comment was marked as off-topic.

@Cookie838
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

10 participants