replay
replay copied to clipboard
PuppeteerRunnerExtension requirnig browser and page is cumbersome
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) );
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.
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?
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) );
Extension
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.
commented
Ok
Bullhockey
Dumbdunns
For someone that is creating a new web browser as a beginner how do you suggest an API