wip
This commit is contained in:
@@ -354,14 +354,40 @@ export class DIContainer {
|
||||
const playwrightAdapter = this.browserAutomation as PlaywrightAutomationAdapter;
|
||||
const result = await playwrightAdapter.connect();
|
||||
if (!result.success) {
|
||||
this.logger.error('Automation connection failed', new Error(result.error || 'Unknown error'), { mode: this.automationMode });
|
||||
this.logger.error(
|
||||
'Automation connection failed',
|
||||
new Error(result.error || 'Unknown error'),
|
||||
{ mode: this.automationMode }
|
||||
);
|
||||
return { success: false, error: result.error };
|
||||
}
|
||||
this.logger.info('Automation connection established', { mode: this.automationMode, adapter: 'Playwright' });
|
||||
|
||||
const isConnected = playwrightAdapter.isConnected();
|
||||
const page = playwrightAdapter.getPage();
|
||||
|
||||
if (!isConnected || !page) {
|
||||
const errorMsg = 'Browser not connected';
|
||||
this.logger.error(
|
||||
'Automation connection reported success but has no usable page',
|
||||
new Error(errorMsg),
|
||||
{ mode: this.automationMode, isConnected, hasPage: !!page }
|
||||
);
|
||||
return { success: false, error: errorMsg };
|
||||
}
|
||||
|
||||
this.logger.info('Automation connection established', {
|
||||
mode: this.automationMode,
|
||||
adapter: 'Playwright'
|
||||
});
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
const errorMsg = error instanceof Error ? error.message : 'Failed to initialize Playwright';
|
||||
this.logger.error('Automation connection failed', error instanceof Error ? error : new Error(errorMsg), { mode: this.automationMode });
|
||||
const errorMsg =
|
||||
error instanceof Error ? error.message : 'Failed to initialize Playwright';
|
||||
this.logger.error(
|
||||
'Automation connection failed',
|
||||
error instanceof Error ? error : new Error(errorMsg),
|
||||
{ mode: this.automationMode }
|
||||
);
|
||||
return {
|
||||
success: false,
|
||||
error: errorMsg
|
||||
|
||||
Reference in New Issue
Block a user