feat: comprehensive console capture and offline mode support
Major enhancements to browser automation and debugging capabilities: **Console Capture Features:** - Add console output file option (CLI, env var, session config) - Enhanced CDP console capture for service worker messages - Browser-level security warnings and mixed content errors - Network failure and loading error capture - All console contexts written to structured log files - Chrome extension for comprehensive console message interception **Offline Mode Support:** - Add browser_set_offline tool for DevTools-equivalent offline mode - Integrate offline mode into browser_configure tool - Support for testing network failure scenarios and service worker behavior **Extension Management:** - Improved extension installation messaging about session persistence - Console capture extension with debugger API access - Clear communication about extension lifecycle to MCP clients **Technical Implementation:** - CDP session management across multiple domains (Runtime, Network, Security, Log) - Service worker context console message interception - Browser context factory integration for offline mode - Pure Chromium configuration for optimal extension support All features provide MCP clients with powerful debugging capabilities equivalent to Chrome DevTools console and offline functionality.
This commit is contained in:
parent
7de63b5bab
commit
afaa8a7014
13 changed files with 603 additions and 20 deletions
|
|
@ -315,6 +315,11 @@ export class Context {
|
|||
|
||||
const browserContext = await browser.newContext(contextOptions);
|
||||
|
||||
// Apply offline mode if configured
|
||||
if ((this.config as any).offline !== undefined) {
|
||||
await browserContext.setOffline((this.config as any).offline);
|
||||
}
|
||||
|
||||
return {
|
||||
browserContext,
|
||||
close: async () => {
|
||||
|
|
@ -373,6 +378,7 @@ export class Context {
|
|||
timezone?: string;
|
||||
colorScheme?: 'light' | 'dark' | 'no-preference';
|
||||
permissions?: string[];
|
||||
offline?: boolean;
|
||||
}): Promise<void> {
|
||||
const currentConfig = { ...this.config };
|
||||
|
||||
|
|
@ -428,6 +434,10 @@ export class Context {
|
|||
currentConfig.browser.contextOptions.permissions = changes.permissions;
|
||||
|
||||
|
||||
if (changes.offline !== undefined)
|
||||
(currentConfig.browser as any).offline = changes.offline;
|
||||
|
||||
|
||||
// Store the modified config
|
||||
(this as any).config = currentConfig;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue