chore: export server for custom transports (#20)
Fixes https://github.com/microsoft/playwright-mcp/issues/11
This commit is contained in:
parent
a394c5be52
commit
8f3214a06a
9 changed files with 205 additions and 122 deletions
|
|
@ -17,13 +17,13 @@
|
|||
import * as playwright from 'playwright';
|
||||
|
||||
export class Context {
|
||||
private _launchOptions: playwright.LaunchOptions;
|
||||
private _launchOptions: playwright.LaunchOptions | undefined;
|
||||
private _browser: playwright.Browser | undefined;
|
||||
private _page: playwright.Page | undefined;
|
||||
private _console: playwright.ConsoleMessage[] = [];
|
||||
private _initializePromise: Promise<void> | undefined;
|
||||
|
||||
constructor(launchOptions: playwright.LaunchOptions) {
|
||||
constructor(launchOptions?: playwright.LaunchOptions) {
|
||||
this._launchOptions = launchOptions;
|
||||
}
|
||||
|
||||
|
|
@ -68,7 +68,7 @@ export class Context {
|
|||
}
|
||||
}
|
||||
|
||||
async function createBrowser(launchOptions: playwright.LaunchOptions): Promise<playwright.Browser> {
|
||||
async function createBrowser(launchOptions?: playwright.LaunchOptions): Promise<playwright.Browser> {
|
||||
if (process.env.PLAYWRIGHT_WS_ENDPOINT) {
|
||||
const url = new URL(process.env.PLAYWRIGHT_WS_ENDPOINT);
|
||||
url.searchParams.set('launch-options', JSON.stringify(launchOptions));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue