As of today, we can't navigate away from a page with beforeunload unless
we have an explicit `beforeunload` handler.
This patch updates our dialog auto-closing logic so that it auto-accepts
all beforeunload dialogs.
Fixes#8144
- Uses some auto fixtures to set default options and instrumentation on BrowserType.
- Moves screenshot, trace and video to worker-scoped fixtures.
- Throws in page/context when used from beforeAll/afterAll.
- Plumbs around BrowserType to be accessible from Browser and BrowserContext.
- fix#6340
- Exposes all the network related events (request, response, requestfailed, requestfinished) through the browser context to allow for managing network activity even if the is any navigations through popups or to new tabs which could result in creation of multiple page objects.
There are a few ways for `connect()` to finish:
- `Browser.close()` from the client side.
- Browser on the server side did exit (e.g. crashed).
- Connection was dropped by either of the sides.
We reduce all the cases to the last one by dropping the
connection when client wants calls `Browser.close()` or
server-side browser exits.
In all these cases we should properly cleanup on the server side,
and ensure that all promises reject on the client side.
We await the predicate now. For synchronous predicates,
nothing should change becase the await will finish before
the next protocol message arrives (thanks to `makeWaitForNextTask`).
These methods are safe to call while the page is still open, or when it is
already closed. Works in remotely connected browser as well.
Also makes video.path() to throw for remotely connected browser.
Under the hood migrated Download and Video to use the common Artifact object.
This makes dialogs disappear and prevents stalling.
Pros:
- No need to worry about dialogs for most users.
- Those that wait for a specific dialog still get to control it.
Cons:
- Those who use Playwright to show interactive browser will have
to add an empty 'dialog' handler to prevent auto-dismiss.
We do this in cli.