wip
This commit is contained in:
@@ -90,8 +90,23 @@ export class PlaywrightBrowserSession {
|
||||
|
||||
async connect(forceHeaded: boolean = false): Promise<{ success: boolean; error?: string }> {
|
||||
if (this.connected && this.page) {
|
||||
this.log('debug', 'Already connected, reusing existing connection');
|
||||
return { success: true };
|
||||
const shouldReuse =
|
||||
!forceHeaded ||
|
||||
this.actualBrowserMode === 'headed';
|
||||
|
||||
if (shouldReuse) {
|
||||
this.log('debug', 'Already connected, reusing existing connection', {
|
||||
browserMode: this.actualBrowserMode,
|
||||
forcedHeaded: forceHeaded,
|
||||
});
|
||||
return { success: true };
|
||||
}
|
||||
|
||||
this.log('info', 'Existing browser connection is headless, reopening in headed mode for login', {
|
||||
browserMode: this.actualBrowserMode,
|
||||
forcedHeaded: forceHeaded,
|
||||
});
|
||||
await this.closeBrowserContext();
|
||||
}
|
||||
|
||||
if (this.isConnecting) {
|
||||
|
||||
Reference in New Issue
Block a user