hero icon indicating copy to clipboard operation
hero copied to clipboard

Use real extensions

Open NN-Binary opened this issue 1 year ago • 10 comments

Hi, I would like to add uBlock origin, is there a way?

NN-Binary avatar Jun 04 '24 10:06 NN-Binary

Kind of, but it's a bit tricky. Hero runs in incognito mode, which makes activating extensions a pain. You can turn off incognito mode, but that restricts each chrome instance to a single Hero session, or you can automate turning on the extension in incognito mode by navigating to the extension pages as the beginning of every Hero session.

You'll need to use a plugin (https://ulixee.org/docs/hero/plugins/core-plugins) to add the chrome launch args to activate the extension. You might also need to remove '--disable-extensions' and a few other conflicting ones from the launchArgs.

class CoreHelloPlugin extends CorePlugin {
    static get id() { return 'ublock-plugin'; }

    onNewBrowser(browser, launchArgs) {
        launchArgs.push(
            `--disable-extensions-except=...`,
            `--load-extension=...`,
        )

    }
}
HeroCore.use(CoreHelloPlugin);

blakebyrnes avatar Jun 04 '24 14:06 blakebyrnes

Thank you!

I think this does not work


        let DirTest = '/home/user/extensions/consentomatic/';
        class CoreHelloPlugin extends CorePlugin {
            
            onNewBrowser(browser, launchArgs) {
                launchArgs.push(
                    `--disable-extensions-except=` + DirTest,
                    `--load-extension=` + DirTest,
                )
            }
            
        }

        Core.use(CoreHelloPlugin);


There is no error whatsoever, I can check also in chrome://version that the flag does not seem to be passed The path is correct, when loading it manually as dev mode, it does work.

NN-Binary avatar Jun 12 '24 12:06 NN-Binary

Sorry, I used bad args for that example. API signature is onNewBrowser?(browser: IBrowser, userConfig: IBrowserUserConfig): void;

should be browser.engine.launchArguments.push(...

blakebyrnes avatar Jun 12 '24 12:06 blakebyrnes

Thank you, it works to load the extension, now an issue is that I can't seem to browse programmatically on chrome://extensions

It instantly crash: 2024-06-12T12:52:25.007Z ERROR [hero-core/index] UnhandledRejection { context: {}, sessionId: null, sessionName: undefined } DisconnectedError: This transport has been disconnected (host: ws://localhost:43369/hero)

If typing manually in the address bar, it does access chrome://extensions without issue (it opens a new chrome window without incognito)

I have tried as well to await 10 seconds and go directly to chrome://extensions/?id=mdjildafknihdffpkfmmpnpoiajfjnjd, same crash.

NN-Binary avatar Jun 12 '24 12:06 NN-Binary

Is there any other errors in the logs that say why chrome crashed (or hero crashed)?

blakebyrnes avatar Jun 12 '24 13:06 blakebyrnes

2024-06-12T13:16:30.160Z ERROR [hero-core/index] UnhandledRejection { context: {}, sessionId: null, sessionName: undefined } DisconnectedError: This transport has been disconnected (host: ws://localhost:38185/hero)
    at ConnectionToHeroCore.onConnectionTerminated (/home/user/MARKETING/node_modules/net/lib/ConnectionToCore.ts:241:33)
    at WsTransportToCore.finalHandler (/home/user/MARKETING/node_modules/commons/lib/EventSubscriber.ts:46:14)
    at Object.onceWrapper (node:events:634:26)
    at WsTransportToCore.emit (node:events:519:28)
    at WsTransportToCore.emit (/home/user/MARKETING/node_modules/commons/lib/TypedEventEmitter.ts:158:18)
    at WsTransportToCore.disconnect (/home/user/MARKETING/node_modules/net/lib/WsTransportToCore.ts:60:10)
    at WebSocket.finalHandler (/home/user/MARKETING/node_modules/commons/lib/EventSubscriber.ts:46:14)
    at Object.onceWrapper (node:events:634:26)
    at WebSocket.emit (node:events:519:28)
    at WebSocket.emitClose (/home/user/MARKETING/node_modules/ws/lib/websocket.js:246:10)
------CONNECTION----------------------------------
  at new Resolvable (/home/user/MARKETING/node_modules/commons/lib/Resolvable.ts:19:18)
    at createPromise (/home/user/MARKETING/node_modules/commons/lib/utils.ts:140:10)
    at PendingMessages.create (/home/user/MARKETING/node_modules/net/lib/PendingMessages.ts:47:44)
    at ConnectionToHeroCore.sendRequest (/home/user/MARKETING/node_modules/net/lib/ConnectionToCore.ts:158:50)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async CoreCommandQueue.sendRequest (/home/user/MARKETING/node_modules/client/lib/CoreCommandQueue.ts:317:12)
    at async Object.cb (/home/user/MARKETING/node_modules/client/lib/CoreCommandQueue.ts:231:16)
    at async Queue.next (/home/user/MARKETING/node_modules/commons/lib/Queue.ts:188:19)
------CORE COMMANDS-------------------------------
    at Queue.run (/home/user/MARKETING/node_modules/commons/lib/Queue.ts:63:19)
    at CoreCommandQueue.run (/home/user/MARKETING/node_modules/client/lib/CoreCommandQueue.ts:220:8)
    at CoreTab.goto (/home/user/MARKETING/node_modules/client/lib/CoreTab.ts:265:36)
    at Tab.goto (/home/user/MARKETING/node_modules/client/lib/Tab.ts:201:36)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async SpawnProfile (/home/user/MARKETING/program/browse.js:716:9)

That's right after goTo action.

NN-Binary avatar Jun 12 '24 13:06 NN-Binary

If you turn on DEBUG=ulx* on the command line, you should get more verbose logging (this is on core side). I don't see any clues in this snippet.

blakebyrnes avatar Jun 12 '24 13:06 blakebyrnes

2024-06-12T13:22:14.590Z STATS [unblocked-agent/lib/DevtoolsSessionLogger] receive:Network.requestWillBeSent {
  pageId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  frameId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  requestId: [32m'1274827.15'[39m,
  params: {
    requestId: [32m'1274827.15'[39m,
    loaderId: [32m'18AC9324CFD6D7B97DA577E0DA4F25A7'[39m,
    documentURL: [32m'chrome://extensions/'[39m,
    request: {
      url: [32m'chrome://resources/roboto/roboto-bold.woff2'[39m,
      method: [32m'GET'[39m,
      headers: {
        Referer: [32m''[39m,
        Origin: [32m'chrome://extensions'[39m,
        [32m'Accept-Language'[39m: [32m'en-US,en;q=0.9'[39m,
        [32m'User-Agent'[39m: [32m'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36'[39m
      },
      mixedContentType: [32m'none'[39m,
      initialPriority: [32m'VeryHigh'[39m,
      referrerPolicy: [32m'strict-origin-when-cross-origin'[39m,
      isSameSite: [33mfalse[39m
    },
    timestamp: [33m100495.60645[39m,
    wallTime: [33m1718198534.584868[39m,
    initiator: { type: [32m'parser'[39m, url: [32m'chrome://resources/css/roboto.css'[39m },
    redirectHasExtraInfo: [33mfalse[39m,
    type: [32m'Font'[39m,
    frameId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
    hasUserGesture: [33mfalse[39m
  },
  devtoolsSessionId: [32m'D3AFFFAB028BBDC1BAB5CC4B3B0E5637'[39m,
  context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m }
}
2024-06-12T13:22:14.591Z STATS [unblocked-agent/lib/DevtoolsSessionLogger] receive:Runtime.bindingCalled {
  pageId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  params: {
    name: [32m'onShadowDomPushedCallbackFn'[39m,
    payload: [32m'[{"localName":"body","id":"","index":1,"hasShadowHost":false},{"localName":"extensions-manager","id":"","index":0,"hasShadowHost":false},{"localName":"div","id":"container","index":9,"hasShadowHost":true},{"localName":"cr-view-manager","id":"viewMana... [truncated 755 chars]'[39m,
    executionContextId: [33m1[39m
  },
  devtoolsSessionId: [32m'D3AFFFAB028BBDC1BAB5CC4B3B0E5637'[39m,
  context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m }
}
2024-06-12T13:22:14.591Z STATS [unblocked-agent/lib/DevtoolsSessionLogger] send:Runtime.evaluate {
  pageId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  frameId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  messageId: [33m93[39m,
  params: {
    expression: [32m'window.checkForShadowRoot([{"localName":"body","id":"","index":1,"hasShadowHost":false},{"localName":"extensions-manager","id":"","index":0,"hasShadowHost":false},{"localName":"div","id":"container","index":9,"hasShadowHost":true},{"localName":"cr-vi... [truncated 782 chars]'[39m,
    contextId: [33m2[39m,
    returnByValue: [33mtrue[39m,
    includeCommandLineAPI: [33mfalse[39m,
    awaitPromise: [33mtrue[39m
  },
  devtoolsSessionId: [32m'D3AFFFAB028BBDC1BAB5CC4B3B0E5637'[39m,
  context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m }
}
2024-06-12T13:22:14.591Z STATS [unblocked-agent/lib/DevtoolsSessionLogger] receive:Network.requestWillBeSent {
  pageId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  frameId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  requestId: [32m'1274827.18'[39m,
  params: {
    requestId: [32m'1274827.18'[39m,
    loaderId: [32m'18AC9324CFD6D7B97DA577E0DA4F25A7'[39m,
    documentURL: [32m'chrome://extensions/'[39m,
    request: {
      url: [32m'chrome://theme/current-channel-logo@1x'[39m,
      method: [32m'GET'[39m,
      headers: {
        [32m'Accept-Language'[39m: [32m'en-US,en;q=0.9'[39m,
        Referer: [32m''[39m,
        [32m'User-Agent'[39m: [32m'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36'[39m
      },
      mixedContentType: [32m'none'[39m,
      initialPriority: [32m'Low'[39m,
      referrerPolicy: [32m'strict-origin-when-cross-origin'[39m,
      isSameSite: [33mfalse[39m
    },
    timestamp: [33m100495.612714[39m,
    wallTime: [33m1718198534.591125[39m,
    initiator: {
      type: [32m'parser'[39m,
      url: [32m'chrome://extensions/'[39m,
      lineNumber: [33m68[39m,
      columnNumber: [33m1[39m
    },
    redirectHasExtraInfo: [33mfalse[39m,
    type: [32m'Image'[39m,
    frameId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
    hasUserGesture: [33mfalse[39m
  },
  devtoolsSessionId: [32m'D3AFFFAB028BBDC1BAB5CC4B3B0E5637'[39m,
  context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m }
}
2024-06-12T13:22:14.591Z STATS [unblocked-agent/lib/DevtoolsSessionLogger] receive:Runtime.bindingCalled {
  pageId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  params: {
    name: [32m'__ulxPagePaintEventListenerCallback'[39m,
    payload: [32m'{"timestamp":1718198534591,"event":"DomContentLoaded","url":"chrome://extensions/"}'[39m,
    executionContextId: [33m2[39m
  },
  devtoolsSessionId: [32m'D3AFFFAB028BBDC1BAB5CC4B3B0E5637'[39m,
  context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m }
}
2024-06-12T13:22:14.608Z STATS [unblocked-agent/lib/DevtoolsSessionLogger] receive:Runtime.bindingCalled {
  pageId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  params: {
    name: [32m'__heroPageListenerCallback'[39m,
    payload: [32m'[[[2,{"nodeType":10,"id":2,"textContent":"<!DOCTYPE html>","parentNodeId":1},1718198534591,3],[2,{"nodeType":1,"id":3,"tagName":"HTML","attributes":{"dir":"ltr","lang":"en","class":"focus-outline-visible"},"parentNodeId":1,"previousSiblingId":2},1718... [truncated 428986 chars]'[39m,
    executionContextId: [33m2[39m
  },
  devtoolsSessionId: [32m'D3AFFFAB028BBDC1BAB5CC4B3B0E5637'[39m,
  context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m }
}
2024-06-12T13:22:14.609Z STATS [hero-core/lib/FrameEnvironment] FrameEnvironment.onPageEvents {
  tabId: [33m1[39m,
  frameId: [33m1[39m,
  dom: [33m990[39m,
  mouse: [33m0[39m,
  focusEvents: [33m0[39m,
  scrollEvents: [33m0[39m,
  loadEvents: [],
  context: { tabId: [33m1[39m, sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m, frameId: [33m1[39m }
}
2024-06-12T13:22:14.611Z STATS [unblocked-agent/lib/DevtoolsSessionLogger] receive:Runtime.bindingCalled {
  pageId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  params: {
    name: [32m'__heroPageListenerCallback'[39m,
    payload: [32m'[[],[],[],[],[["DomContentLoaded","chrome://extensions/",1718198534591]]]'[39m,
    executionContextId: [33m2[39m
  },
  devtoolsSessionId: [32m'D3AFFFAB028BBDC1BAB5CC4B3B0E5637'[39m,
  context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m }
}
2024-06-12T13:22:14.611Z STATS [hero-core/lib/FrameEnvironment] FrameEnvironment.onPageEvents {
  tabId: [33m1[39m,
  frameId: [33m1[39m,
  dom: [33m0[39m,
  mouse: [33m0[39m,
  focusEvents: [33m0[39m,
  scrollEvents: [33m0[39m,
  loadEvents: [ [ [32m'DomContentLoaded'[39m, [32m'chrome://extensions/'[39m, [33m1718198534591[39m ] ],
  context: { tabId: [33m1[39m, sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m, frameId: [33m1[39m }
}
2024-06-12T13:22:14.611Z STATS [unblocked-agent/lib/DevtoolsSessionLogger] receive:Page.domContentEventFired {
  pageId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  params: { timestamp: [33m100495.628244[39m },
  devtoolsSessionId: [32m'D3AFFFAB028BBDC1BAB5CC4B3B0E5637'[39m,
  context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m }
}
2024-06-12T13:22:14.611Z STATS [unblocked-agent/lib/DevtoolsSessionLogger] receive:Page.lifecycleEvent {
  pageId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  frameId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  params: {
    frameId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
    loaderId: [32m'18AC9324CFD6D7B97DA577E0DA4F25A7'[39m,
    name: [32m'DOMContentLoaded'[39m,
    timestamp: [33m100495.628244[39m
  },
  devtoolsSessionId: [32m'D3AFFFAB028BBDC1BAB5CC4B3B0E5637'[39m,
  context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m }
}
2024-06-12T13:22:14.612Z STATS [unblocked-agent/lib/FrameNavigations] emit:status-change {
  id: [33m1[39m,
  url: [32m'chrome://extensions/'[39m,
  statusChanges: {
    HttpRequested: [33m1718198534453[39m,
    HttpResponded: [33m1718198534453[39m,
    DomContentLoaded: [33m1718198534606.6357[39m
  },
  newStatus: [32m'DomContentLoaded'[39m,
  context: {
    sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m,
    browserContextId: [32m'91B21D6427315D75FC021BF0D8CF3A91'[39m,
    targetId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
    frameId: [33m1[39m
  }
}
2024-06-12T13:22:14.612Z STATS [unblocked-agent/lib/DevtoolsSessionLogger] receive:Network.requestWillBeSent {
  pageId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  frameId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  requestId: [32m'1274827.14'[39m,
  params: {
    requestId: [32m'1274827.14'[39m,
    loaderId: [32m'18AC9324CFD6D7B97DA577E0DA4F25A7'[39m,
    documentURL: [32m'chrome://extensions/'[39m,
    request: {
      url: [32m'chrome://resources/roboto/roboto-medium.woff2'[39m,
      method: [32m'GET'[39m,
      headers: {
        Referer: [32m''[39m,
        Origin: [32m'chrome://extensions'[39m,
        [32m'Accept-Language'[39m: [32m'en-US,en;q=0.9'[39m,
        [32m'User-Agent'[39m: [32m'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36'[39m
      },
      mixedContentType: [32m'none'[39m,
      initialPriority: [32m'VeryHigh'[39m,
      referrerPolicy: [32m'strict-origin-when-cross-origin'[39m,
      isSameSite: [33mfalse[39m
    },
    timestamp: [33m100495.631225[39m,
    wallTime: [33m1718198534.609641[39m,
    initiator: { type: [32m'parser'[39m, url: [32m'chrome://resources/css/roboto.css'[39m },
    redirectHasExtraInfo: [33mfalse[39m,
    type: [32m'Font'[39m,
    frameId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
    hasUserGesture: [33mfalse[39m
  },
  devtoolsSessionId: [32m'D3AFFFAB028BBDC1BAB5CC4B3B0E5637'[39m,
  context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m }
}
2024-06-12T13:22:14.625Z STATS [unblocked-agent/lib/DevtoolsSessionLogger] receive:Network.resourceChangedPriority {
  pageId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  requestId: [32m'1274827.18'[39m,
  params: {
    requestId: [32m'1274827.18'[39m,
    newPriority: [32m'High'[39m,
    timestamp: [33m100495.642572[39m
  },
  devtoolsSessionId: [32m'D3AFFFAB028BBDC1BAB5CC4B3B0E5637'[39m,
  context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m }
}
2024-06-12T13:22:14.625Z STATS [unblocked-agent/lib/DevtoolsSessionLogger] receive:Runtime.evaluate {
  pageId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  frameId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  messageId: [33m58[39m,
  result: { result: { type: [32m'undefined'[39m } },
  devtoolsSessionId: [32m'D3AFFFAB028BBDC1BAB5CC4B3B0E5637'[39m,
  context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m }
}
2024-06-12T13:22:14.626Z STATS [unblocked-agent/lib/DevtoolsSessionLogger] receive:Runtime.evaluate {
  pageId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  frameId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  messageId: [33m59[39m,
  result: { result: { type: [32m'undefined'[39m } },
  devtoolsSessionId: [32m'D3AFFFAB028BBDC1BAB5CC4B3B0E5637'[39m,
  context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m }
}
2024-06-12T13:22:14.626Z STATS [unblocked-agent/lib/DevtoolsSessionLogger] receive:Runtime.evaluate {
  pageId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  frameId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  messageId: [33m60[39m,
  result: { result: { type: [32m'undefined'[39m } },
  devtoolsSessionId: [32m'D3AFFFAB028BBDC1BAB5CC4B3B0E5637'[39m,
  context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m }
}
2024-06-12T13:22:14.626Z STATS [unblocked-agent/lib/DevtoolsSessionLogger] receive:Runtime.evaluate {
  pageId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  frameId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  messageId: [33m61[39m,
  result: { result: { type: [32m'undefined'[39m } },
  devtoolsSessionId: [32m'D3AFFFAB028BBDC1BAB5CC4B3B0E5637'[39m,
  context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m }
}
2024-06-12T13:22:14.626Z STATS [unblocked-agent/lib/DevtoolsSessionLogger] receive:Runtime.evaluate {
  pageId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  frameId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  messageId: [33m62[39m,
  result: { result: { type: [32m'undefined'[39m } },
  devtoolsSessionId: [32m'D3AFFFAB028BBDC1BAB5CC4B3B0E5637'[39m,
  context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m }
}
2024-06-12T13:22:14.626Z STATS [unblocked-agent/lib/DevtoolsSessionLogger] receive:Runtime.evaluate {
  pageId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  frameId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  messageId: [33m63[39m,
  result: { result: { type: [32m'undefined'[39m } },
  devtoolsSessionId: [32m'D3AFFFAB028BBDC1BAB5CC4B3B0E5637'[39m,
  context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m }
}
2024-06-12T13:22:14.627Z STATS [unblocked-agent/lib/DevtoolsSessionLogger] receive:Runtime.evaluate {
  pageId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  frameId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  messageId: [33m64[39m,
  result: { result: { type: [32m'undefined'[39m } },
  devtoolsSessionId: [32m'D3AFFFAB028BBDC1BAB5CC4B3B0E5637'[39m,
  context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m }
}
2024-06-12T13:22:14.627Z STATS [unblocked-agent/lib/DevtoolsSessionLogger] receive:Runtime.evaluate {
  pageId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  frameId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  messageId: [33m65[39m,
  result: { result: { type: [32m'undefined'[39m } },
  devtoolsSessionId: [32m'D3AFFFAB028BBDC1BAB5CC4B3B0E5637'[39m,
  context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m }
}
2024-06-12T13:22:14.627Z STATS [unblocked-agent/lib/DevtoolsSessionLogger] receive:Runtime.evaluate {
  pageId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  frameId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  messageId: [33m66[39m,
  result: { result: { type: [32m'undefined'[39m } },
  devtoolsSessionId: [32m'D3AFFFAB028BBDC1BAB5CC4B3B0E5637'[39m,
  context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m }
}
2024-06-12T13:22:14.627Z STATS [unblocked-agent/lib/DevtoolsSessionLogger] receive:Runtime.evaluate {
  pageId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  frameId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  messageId: [33m67[39m,
  result: { result: { type: [32m'undefined'[39m } },
  devtoolsSessionId: [32m'D3AFFFAB028BBDC1BAB5CC4B3B0E5637'[39m,
  context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m }
}
2024-06-12T13:22:14.627Z STATS [unblocked-agent/lib/DevtoolsSessionLogger] receive:Runtime.evaluate {
  pageId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  frameId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  messageId: [33m68[39m,
  result: { result: { type: [32m'undefined'[39m } },
  devtoolsSessionId: [32m'D3AFFFAB028BBDC1BAB5CC4B3B0E5637'[39m,
  context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m }
}
2024-06-12T13:22:14.627Z STATS [unblocked-agent/lib/DevtoolsSessionLogger] receive:Runtime.evaluate {
  pageId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  frameId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  messageId: [33m69[39m,
  result: { result: { type: [32m'undefined'[39m } },
  devtoolsSessionId: [32m'D3AFFFAB028BBDC1BAB5CC4B3B0E5637'[39m,
  context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m }
}
2024-06-12T13:22:14.627Z STATS [unblocked-agent/lib/DevtoolsSessionLogger] receive:Runtime.evaluate {
  pageId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  frameId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  messageId: [33m70[39m,
  result: { result: { type: [32m'undefined'[39m } },
  devtoolsSessionId: [32m'D3AFFFAB028BBDC1BAB5CC4B3B0E5637'[39m,
  context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m }
}
2024-06-12T13:22:14.627Z STATS [unblocked-agent/lib/DevtoolsSessionLogger] receive:Runtime.evaluate {
  pageId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  frameId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  messageId: [33m71[39m,
  result: { result: { type: [32m'undefined'[39m } },
  devtoolsSessionId: [32m'D3AFFFAB028BBDC1BAB5CC4B3B0E5637'[39m,
  context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m }
}
2024-06-12T13:22:14.627Z STATS [unblocked-agent/lib/DevtoolsSessionLogger] receive:Runtime.evaluate {
  pageId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  frameId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  messageId: [33m72[39m,
  result: { result: { type: [32m'undefined'[39m } },
  devtoolsSessionId: [32m'D3AFFFAB028BBDC1BAB5CC4B3B0E5637'[39m,
  context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m }
}
2024-06-12T13:22:14.627Z STATS [unblocked-agent/lib/DevtoolsSessionLogger] receive:Runtime.evaluate {
  pageId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  frameId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  messageId: [33m73[39m,
  result: { result: { type: [32m'undefined'[39m } },
  devtoolsSessionId: [32m'D3AFFFAB028BBDC1BAB5CC4B3B0E5637'[39m,
  context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m }
}
2024-06-12T13:22:14.627Z STATS [unblocked-agent/lib/DevtoolsSessionLogger] receive:Runtime.evaluate {
  pageId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  frameId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  messageId: [33m74[39m,
  result: { result: { type: [32m'undefined'[39m } },
  devtoolsSessionId: [32m'D3AFFFAB028BBDC1BAB5CC4B3B0E5637'[39m,
  context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m }
}
2024-06-12T13:22:14.627Z STATS [unblocked-agent/lib/DevtoolsSessionLogger] receive:Runtime.evaluate {
  pageId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  frameId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  messageId: [33m75[39m,
  result: { result: { type: [32m'undefined'[39m } },
  devtoolsSessionId: [32m'D3AFFFAB028BBDC1BAB5CC4B3B0E5637'[39m,
  context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m }
}
2024-06-12T13:22:14.628Z STATS [unblocked-agent/lib/DevtoolsSessionLogger] receive:Runtime.evaluate {
  pageId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  frameId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  messageId: [33m76[39m,
  result: { result: { type: [32m'undefined'[39m } },
  devtoolsSessionId: [32m'D3AFFFAB028BBDC1BAB5CC4B3B0E5637'[39m,
  context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m }
}
2024-06-12T13:22:14.628Z STATS [unblocked-agent/lib/DevtoolsSessionLogger] receive:Runtime.evaluate {
  pageId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  frameId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  messageId: [33m77[39m,
  result: { result: { type: [32m'undefined'[39m } },
  devtoolsSessionId: [32m'D3AFFFAB028BBDC1BAB5CC4B3B0E5637'[39m,
  context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m }
}
2024-06-12T13:22:14.628Z STATS [unblocked-agent/lib/DevtoolsSessionLogger] receive:Runtime.evaluate {
  pageId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  frameId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  messageId: [33m78[39m,
  result: { result: { type: [32m'undefined'[39m } },
  devtoolsSessionId: [32m'D3AFFFAB028BBDC1BAB5CC4B3B0E5637'[39m,
  context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m }
}
2024-06-12T13:22:14.628Z STATS [unblocked-agent/lib/DevtoolsSessionLogger] receive:Runtime.evaluate {
  pageId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  frameId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  messageId: [33m79[39m,
  result: { result: { type: [32m'undefined'[39m } },
  devtoolsSessionId: [32m'D3AFFFAB028BBDC1BAB5CC4B3B0E5637'[39m,
  context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m }
}
2024-06-12T13:22:14.628Z STATS [unblocked-agent/lib/DevtoolsSessionLogger] receive:Runtime.evaluate {
  pageId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  frameId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  messageId: [33m80[39m,
  result: { result: { type: [32m'undefined'[39m } },
  devtoolsSessionId: [32m'D3AFFFAB028BBDC1BAB5CC4B3B0E5637'[39m,
  context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m }
}
2024-06-12T13:22:14.628Z STATS [unblocked-agent/lib/DevtoolsSessionLogger] receive:Runtime.evaluate {
  pageId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  frameId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  messageId: [33m81[39m,
  result: { result: { type: [32m'undefined'[39m } },
  devtoolsSessionId: [32m'D3AFFFAB028BBDC1BAB5CC4B3B0E5637'[39m,
  context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m }
}
2024-06-12T13:22:14.628Z STATS [unblocked-agent/lib/DevtoolsSessionLogger] receive:Runtime.evaluate {
  pageId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  frameId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  messageId: [33m82[39m,
  result: { result: { type: [32m'undefined'[39m } },
  devtoolsSessionId: [32m'D3AFFFAB028BBDC1BAB5CC4B3B0E5637'[39m,
  context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m }
}
2024-06-12T13:22:14.628Z STATS [unblocked-agent/lib/DevtoolsSessionLogger] receive:Runtime.evaluate {
  pageId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  frameId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  messageId: [33m83[39m,
  result: { result: { type: [32m'undefined'[39m } },
  devtoolsSessionId: [32m'D3AFFFAB028BBDC1BAB5CC4B3B0E5637'[39m,
  context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m }
}
2024-06-12T13:22:14.628Z STATS [unblocked-agent/lib/DevtoolsSessionLogger] receive:Runtime.evaluate {
  pageId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  frameId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  messageId: [33m84[39m,
  result: { result: { type: [32m'undefined'[39m } },
  devtoolsSessionId: [32m'D3AFFFAB028BBDC1BAB5CC4B3B0E5637'[39m,
  context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m }
}
2024-06-12T13:22:14.628Z STATS [unblocked-agent/lib/DevtoolsSessionLogger] receive:Runtime.evaluate {
  pageId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  frameId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  messageId: [33m85[39m,
  result: { result: { type: [32m'undefined'[39m } },
  devtoolsSessionId: [32m'D3AFFFAB028BBDC1BAB5CC4B3B0E5637'[39m,
  context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m }
}
2024-06-12T13:22:14.632Z STATS [unblocked-agent/lib/DevtoolsSessionLogger] receive:Runtime.evaluate {
  pageId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  frameId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  messageId: [33m86[39m,
  result: { result: { type: [32m'undefined'[39m } },
  devtoolsSessionId: [32m'D3AFFFAB028BBDC1BAB5CC4B3B0E5637'[39m,
  context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m }
}
2024-06-12T13:22:14.632Z STATS [unblocked-agent/lib/DevtoolsSessionLogger] receive:Runtime.evaluate {
  pageId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  frameId: [32m'EE0BFA582D29C3A7EC6FC22F2FC6F94D'[39m,
  messageId: [33m87[39m,
  result: { result: { type: [32m'undefined'[39m } },
  devtoolsSessionId: [32m'D3AFFFAB028BBDC1BAB5CC4B3B0E5637'[39m,
  context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m }
}
2024-06-12T13:22:14.641Z WARN [unblocked-agent/lib/BrowserProcess] chrome.stderr {
  message: [32m'[0612/212214.641317:ERROR:file_io_posix.cc(145)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2)'[39m,
  context: {},
  sessionId: [1mnull[22m,
  sessionName: [90mundefined[39m
}
2024-06-12T13:22:14.641Z WARN [unblocked-agent/lib/BrowserProcess] chrome.stderr {
  message: [32m'[0612/212214.641363:ERROR:file_io_posix.cc(145)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq: No such file or directory (2)'[39m,
  context: {},
  sessionId: [1mnull[22m,
  sessionName: [90mundefined[39m
}
2024-06-12T13:22:14.666Z INFO [unblocked-agent/lib/PipeTransport] PipeTransport.Closed { context: {} }
2024-06-12T13:22:14.667Z INFO [unblocked-agent/lib/BrowserProcess] chrome.ProcessExited { context: {} }
2024-06-12T13:22:14.668Z INFO [unblocked-agent/lib/Agent] Agent.Closing { context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m } }
2024-06-12T13:22:14.669Z INFO [unblocked-agent/lib/BrowserContext] BrowserContext.Closing {
  context: {
    sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m,
    browserContextId: [32m'91B21D6427315D75FC021BF0D8CF3A91'[39m
  }
}
2024-06-12T13:22:14.672Z STATS [hero-core/lib/Tab] Tab.Closing { context: { tabId: [33m1[39m, sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m } }
2024-06-12T13:22:14.672Z STATS [unblocked-agent/lib/BrowserContext] BrowserContext.Closed 3ms {
  context: {
    sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m,
    browserContextId: [32m'91B21D6427315D75FC021BF0D8CF3A91'[39m
  }
}
2024-06-12T13:22:14.681Z STATS [hero-core/lib/FrameEnvironment] FrameEnvironment.Closing {
  context: { tabId: [33m1[39m, sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m, frameId: [33m1[39m }
}
2024-06-12T13:22:14.681Z STATS [hero-core/lib/FrameEnvironment] FrameEnvironment.Closed {
  context: { tabId: [33m1[39m, sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m, frameId: [33m1[39m }
}
2024-06-12T13:22:14.682Z STATS [unblocked-agent-mitm/handlers/RequestSession] MitmRequestSession.Closing { context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m } }
2024-06-12T13:22:14.682Z INFO [unblocked-agent-mitm-socket/lib/MitmSocketSession] ProxyIpcHandler.Closing { context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m } }
2024-06-12T13:22:14.682Z INFO [unblocked-agent-mitm-socket/index] MitmSocket.Closing { context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m } }
2024-06-12T13:22:14.682Z STATS [unblocked-agent-mitm/lib/SocketPool] Socket closed {
  context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m, origin: [32m'test.com:443'[39m }
}
2024-06-12T13:22:14.682Z STATS [unblocked-agent-mitm-socket/index] MitmSocket.Closed { context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m } }
2024-06-12T13:22:14.682Z INFO [unblocked-agent-mitm-socket/index] MitmSocket.Closing { context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m } }
2024-06-12T13:22:14.682Z STATS [unblocked-agent-mitm/lib/SocketPool] Socket closed {
  context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m, origin: [32m'www.google.com:443'[39m }
}
2024-06-12T13:22:14.683Z STATS [unblocked-agent-mitm-socket/index] MitmSocket.Closed 1ms { context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m } }
2024-06-12T13:22:14.683Z INFO [unblocked-agent-mitm-socket/index] MitmSocket.Closing { context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m } }
2024-06-12T13:22:14.683Z STATS [unblocked-agent-mitm/lib/SocketPool] Socket closed {
  context: {
    sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m,
    origin: [32m'stackoverflow.com:443'[39m
  }
}
2024-06-12T13:22:14.683Z STATS [unblocked-agent-mitm-socket/index] MitmSocket.Closed { context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m } }
2024-06-12T13:22:14.683Z STATS [unblocked-agent-mitm-socket/lib/MitmSocketSession] ProxyIpcHandler.Closed 1ms { context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m } }
2024-06-12T13:22:14.683Z STATS [unblocked-agent-mitm/handlers/RequestSession] MitmRequestSession.Closed 1ms { errors: [], context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m } }
2024-06-12T13:22:14.683Z INFO [unblocked-agent-mitm/lib/MitmProxy] MitmProxy.Closing { context: {} }
2024-06-12T13:22:14.684Z STATS [unblocked-agent-mitm/lib/MitmProxy] MitmProxy.Closed 1ms { closeErrors: [], context: {} }
2024-06-12T13:22:14.685Z INFO [unblocked-agent/lib/Pool] Pool.ReleasingAgent {
  maxConcurrentAgents: [33m10[39m,
  activeAgentsCount: [33m0[39m,
  waitingForAvailability: [33m0[39m,
  context: {}
}
2024-06-12T13:22:14.685Z STATS [unblocked-agent/lib/Agent] Agent.Closed 17ms { context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m } }
2024-06-12T13:22:14.685Z STATS [hero-core/lib/Tab] emit:close { context: { tabId: [33m1[39m, sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m } }
2024-06-12T13:22:14.685Z STATS [hero-core/lib/Tab] Tab.Closed 13ms {
  errors: [
    [32m"TypeError: Cannot read properties of null (reading 'finalFlush')"[39m
  ],
  context: { tabId: [33m1[39m, sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m }
}
2024-06-12T13:22:14.685Z STATS [hero-core/lib/CommandRecorder] Command.done 242ms {
  id: [33m1[39m,
  context: { tabId: [33m1[39m, sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m, frameId: [33m1[39m }
} CanceledPromiseError: Cancel Pending Promise. Frame closed.
    at FrameNavigationsObserver.cancelWaiting (/home/user/test/Reborn/poc/MARKETING/agent/main/lib/FrameNavigationsObserver.ts:128:24)
    at Frame.close (/home/user/test/Reborn/poc/MARKETING/agent/main/lib/Frame.ts:204:30)
    at FramesManager.close (/home/user/test/Reborn/poc/MARKETING/agent/main/lib/FramesManager.ts:204:13)
    at Page.didClose (/home/user/test/Reborn/poc/MARKETING/agent/main/lib/Page.ts:559:26)
    at /home/user/test/Reborn/poc/MARKETING/agent/main/lib/BrowserContext.ts:349:47
    at Array.map (<anonymous>)
    at BrowserContext.close (/home/user/test/Reborn/poc/MARKETING/agent/main/lib/BrowserContext.ts:349:36)
    at Agent.close (/home/user/test/Reborn/poc/MARKETING/agent/main/lib/Agent.ts:174:34)
    at Pool.onBrowserClosed (/home/user/test/Reborn/poc/MARKETING/agent/main/lib/Pool.ts:295:70)
    at /home/user/test/Reborn/poc/MARKETING/agent/main/lib/Pool.ts:171:53
------LOCATION------------------------------------
  at new Resolvable (/home/user/test/Reborn/poc/MARKETING/node_modules/[4mcommons[24m/lib/Resolvable.ts:19:18)
    at createPromise (/home/user/test/Reborn/poc/MARKETING/node_modules/[4mcommons[24m/lib/utils.ts:140:10)
    at FrameNavigations.onNavigationRequested (/home/user/test/Reborn/poc/MARKETING/agent/main/lib/FrameNavigations.ts:148:44)
    at Page.goto (/home/user/test/Reborn/poc/MARKETING/agent/main/lib/Page.ts:309:51)
    at Tab.goto (/home/user/test/Reborn/poc/MARKETING/node_modules/[4mcore[24m/lib/Tab.ts:519:28)
    at CommandRecorder.runCommandFn (/home/user/test/Reborn/poc/MARKETING/node_modules/[4mcore[24m/lib/CommandRecorder.ts:90:32)
[90m    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)[39m
    at async CommandRunner.runFn (/home/user/test/Reborn/poc/MARKETING/node_modules/[4mcore[24m/lib/CommandRunner.ts:36:14)
    at async ConnectionToHeroClient.executeCommand (/home/user/test/Reborn/poc/MARKETING/node_modules/[4mcore[24m/connections/ConnectionToHeroClient.ts:258:12)
    at async ConnectionToHeroClient.handleRequest (/home/user/test/Reborn/poc/MARKETING/node_modules/[4mcore[24m/connections/ConnectionToHeroClient.ts:66:14)
2024-06-12T13:22:14.685Z INFO [unblocked-agent/lib/Pool] Browser.closed {
  engine: {
    launchArguments: [
      [32m'--proxy-bypass-list=<-loopback>'[39m,
      [32m'--proxy-server=localhost:43223'[39m,
      [32m'--remote-debugging-pipe'[39m,
      [32m'--ignore-certificate-errors'[39m,
      [32m'--disable-background-networking'[39m,
      [32m'--enable-features=NetworkService,NetworkServiceInProcess'[39m,
      [32m'--disable-background-timer-throttling'[39m,
      [32m'--disable-backgrounding-occluded-windows'[39m,
      [32m'--disable-breakpad'[39m,
      [32m'--disable-client-side-phishing-detection'[39m,
      [32m'--disable-domain-reliability'[39m,
      [32m'--disable-default-apps'[39m,
      [32m'--disable-dev-shm-usage'[39m,
      [32m'--load-extension=/home/user/test/Reborn/poc/MARKETING/program/extensions/consentomatic/'[39m,
      [32m'--disable-features=PaintHolding,LazyFrameLoading,DestroyProfileOnBrowserClose,AvoidUnnecessaryBeforeUnloadCheckSync,OutOfBlinkCors,GlobalMediaControls,MediaRouter,DialMediaRouteProvider,OptimizationHints'[39m,
      [32m'--disable-blink-features=AutomationControlled'[39m,
      [32m'--disable-hang-monitor'[39m,
      [32m'--disable-ipc-flooding-protection'[39m,
      [32m'--disable-prompt-on-repost'[39m,
      [32m'--disable-renderer-backgrounding'[39m,
      [32m'--disable-sync'[39m,
      [32m'--force-color-profile=srgb'[39m,
      [32m'--disable-skia-runtime-opts'[39m,
      [32m'--use-fake-device-for-media-stream'[39m,
      [32m'--no-default-browser-check'[39m,
      [32m'--metrics-recording-only'[39m,
      [32m'--no-first-run'[39m,
      [32m'--enable-auto-reload'[39m,
      [32m'--password-store=basic'[39m,
      [32m'--use-mock-keychain'[39m,
      [32m'--allow-running-insecure-content'[39m,
      [32m'--window-size=1440,900'[39m,
      [32m'--force-webrtc-ip-handling-policy=default_public_interface_only'[39m,
      [32m'--no-startup-window'[39m,
      [32m'--user-data-dir=/tmp/7pVIy-1-121-0-6167-184'[39m
    ],
    doesBrowserAnimateScrolling: [33mtrue[39m,
    engineFetcher: {
      fullVersion: [32m'121.0.6167.184'[39m,
      osPlatformName: [32m'linux'[39m,
      executablePathEnvVar: [32m'CHROME_121_BIN'[39m,
      executablePath: [32m'/home/user/.cache/ulixee/chrome/121.0.6167.184/chrome'[39m,
      symlinkVersionDir: [32m'/home/user/.cache/ulixee/chrome/121.0.6167.185'[39m
    },
    engineOption: {
      id: [32m'chrome-121-0'[39m,
      name: [32m'chrome'[39m,
      majorVersion: [33m121[39m,
      buildVersion: [33m6167[39m,
      stablePatchesByOs: {
        mac: [ [33m184[39m, [33m160[39m, [33m139[39m, [33m85[39m ],
        win: [ [33m185[39m, [33m161[39m, [33m140[39m, [33m86[39m ],
        linux: [ [33m184[39m, [33m160[39m, [33m139[39m, [33m85[39m ]
      }
    },
    name: [32m'chrome'[39m,
    fullVersion: [32m'121.0.6167.184'[39m,
    executablePath: [32m'/home/user/.cache/ulixee/chrome/121.0.6167.184/chrome'[39m,
    executablePathEnvVar: [32m'CHROME_121_BIN'[39m,
    isInstalled: [33mtrue[39m,
    isHeaded: [33mtrue[39m,
    userDataDir: [32m'/tmp/7pVIy-1-121-0-6167-184'[39m
  },
  browserId: [32m'1'[39m,
  context: {}
}
Automatically shutting down Hero Core (Browser Closed)
2024-06-12T13:22:14.686Z INFO [hero-core/index] Core.shutdown { context: {} }
2024-06-12T13:22:14.686Z STATS [hero-core/connections/ConnectionToHeroClient] ConnectionToClient.Disconnecting { context: {} }
2024-06-12T13:22:14.686Z STATS [hero-core/connections/ConnectionToHeroClient] ConnectionToClient.Disconnecting { context: {} }
2024-06-12T13:22:14.687Z STATS [unblocked-agent/lib/Pool] Pool.Closing { browsers: [33m0[39m, context: {} }
2024-06-12T13:22:14.687Z INFO [unblocked-agent-mitm/lib/MitmProxy] MitmProxy.Closing { context: {} }
2024-06-12T13:22:14.687Z STATS [unblocked-agent-mitm/lib/MitmProxy] MitmProxy.Closed { closeErrors: [], context: {} }
2024-06-12T13:22:14.687Z INFO [unblocked-agent-mitm-socket/lib/CertificateGenerator] CertsIpcHandler.Closing { context: {} }
2024-06-12T13:22:14.687Z STATS [unblocked-agent-mitm-socket/lib/CertificateGenerator] CertsIpcHandler.Closed { context: {} }
2024-06-12T13:22:14.687Z INFO [hero-core/lib/CommandRecorder] Command.run {
  id: [33m2[39m,
  name: [32m'close'[39m,
  retryNumber: [33m0[39m,
  args: [ [33mtrue[39m ],
  context: {
    tabId: [90mundefined[39m,
    sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m,
    frameId: [90mundefined[39m
  }
}
2024-06-12T13:22:14.688Z STATS [unblocked-agent/lib/Pool] Pool.Closed 1ms { errors: [], context: {} }
2024-06-12T13:22:14.688Z STATS [hero-core/connections/ConnectionToHeroClient] ConnectionToClient.Disconnected 2ms { context: {} }
2024-06-12T13:22:14.688Z INFO [hero-core/lib/Session] Session.Closing { context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m } }
2024-06-12T13:22:14.688Z STATS [hero-core/lib/Session] Session.Closed { context: { sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m } }
2024-06-12T13:22:14.815Z STATS [hero-core/lib/CommandRecorder] Command.done 128ms {
  id: [33m2[39m,
  context: {
    tabId: [90mundefined[39m,
    sessionId: [32m'zhrx7jKJh0g7eyy3bS0kd'[39m,
    frameId: [90mundefined[39m
  }
}
2024-06-12T13:22:14.815Z STATS [hero-core/connections/ConnectionToHeroClient] ConnectionToClient.Disconnected 129ms { context: {} }
2024-06-12T13:22:14.816Z STATS [cloud/lib/CloudNode] CloudNode.Closing { context: {} }
2024-06-12T13:22:14.816Z INFO [hero-core/index] Core.shutdownComplete 130ms { context: {} }
2024-06-12T13:22:14.816Z STATS [datastore-core/index] DatastoreCore.Closing { context: {} }
2024-06-12T13:22:14.816Z INFO [datastore-core/lib/WorkTracker] Waiting for completing of remaining Datastore.query calls { count: [33m0[39m, context: {} }
2024-06-12T13:22:14.816Z STATS [net/lib/ConnectionToCore] ConnectionToCore.Disconnecting { host: [32m'direct'[39m, context: {} }
2024-06-12T13:22:14.817Z STATS [net/lib/ConnectionToCore] ConnectionToCore.Disconnected 1ms { host: [32m'direct'[39m, context: {} }
2024-06-12T13:22:14.817Z STATS [datastore-core/index] DatastoreCore.Closed 1ms { context: {} }
2024-06-12T13:22:14.817Z STATS [cloud/lib/RoutableServer] RoutingServer.Closing { context: {} }
2024-06-12T13:22:14.818Z STATS [cloud/lib/RoutableServer] RoutingServer.Closed 1ms { context: {} }
2024-06-12T13:22:14.818Z STATS [cloud/lib/CloudNode] CloudNode.Closed 2ms { context: {} }
2024-06-12T13:22:14.821Z ERROR [hero-core/index] UnhandledRejection { context: {}, sessionId: [1mnull[22m, sessionName: [90mundefined[39m } DisconnectedError: This transport has been disconnected (host: ws://localhost:36257/hero)
    at ConnectionToHeroCore.onConnectionTerminated (/home/user/test/Reborn/poc/MARKETING/node_modules/[4mnet[24m/lib/ConnectionToCore.ts:241:33)
    at WsTransportToCore.finalHandler (/home/user/test/Reborn/poc/MARKETING/node_modules/[4mcommons[24m/lib/EventSubscriber.ts:46:14)
[90m    at Object.onceWrapper (node:events:634:26)[39m
[90m    at WsTransportToCore.emit (node:events:519:28)[39m
    at WsTransportToCore.emit (/home/user/test/Reborn/poc/MARKETING/node_modules/[4mcommons[24m/lib/TypedEventEmitter.ts:158:18)
    at WsTransportToCore.disconnect (/home/user/test/Reborn/poc/MARKETING/node_modules/[4mnet[24m/lib/WsTransportToCore.ts:60:10)
    at WebSocket.finalHandler (/home/user/test/Reborn/poc/MARKETING/node_modules/[4mcommons[24m/lib/EventSubscriber.ts:46:14)
[90m    at Object.onceWrapper (node:events:634:26)[39m
[90m    at WebSocket.emit (node:events:519:28)[39m
    at WebSocket.emitClose (/home/user/test/Reborn/poc/MARKETING/node_modules/[4mws[24m/lib/websocket.js:246:10)
------CONNECTION----------------------------------
  at new Resolvable (/home/user/test/Reborn/poc/MARKETING/node_modules/[4mcommons[24m/lib/Resolvable.ts:19:18)
    at createPromise (/home/user/test/Reborn/poc/MARKETING/node_modules/[4mcommons[24m/lib/utils.ts:140:10)
    at PendingMessages.create (/home/user/test/Reborn/poc/MARKETING/node_modules/[4mnet[24m/lib/PendingMessages.ts:47:44)
    at ConnectionToHeroCore.sendRequest (/home/user/test/Reborn/poc/MARKETING/node_modules/[4mnet[24m/lib/ConnectionToCore.ts:158:50)
[90m    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)[39m
    at async CoreCommandQueue.sendRequest (/home/user/test/Reborn/poc/MARKETING/node_modules/[4mclient[24m/lib/CoreCommandQueue.ts:317:12)
    at async Object.cb (/home/user/test/Reborn/poc/MARKETING/node_modules/[4mclient[24m/lib/CoreCommandQueue.ts:231:16)
    at async Queue.next (/home/user/test/Reborn/poc/MARKETING/node_modules/[4mcommons[24m/lib/Queue.ts:188:19)
------CORE COMMANDS-------------------------------
    at Queue.run (/home/user/test/Reborn/poc/MARKETING/node_modules/[4mcommons[24m/lib/Queue.ts:63:19)
    at CoreCommandQueue.run (/home/user/test/Reborn/poc/MARKETING/node_modules/[4mclient[24m/lib/CoreCommandQueue.ts:220:8)
    at CoreTab.goto (/home/user/test/Reborn/poc/MARKETING/node_modules/[4mclient[24m/lib/CoreTab.ts:265:36)
    at Tab.goto (/home/user/test/Reborn/poc/MARKETING/node_modules/[4mclient[24m/lib/Tab.ts:201:36)
[90m    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)[39m
    at async SpawnProfile [90m(/home/user/test/Reborn/poc/MARKETING/program/[39mbrowse.js:716:9[90m)[39m

--------------------------------------------------
------test----------------------------------------
------zhrx7jKJh0g7eyy3bS0kd-----------------------
-------------------------------------------------- {
  host: [32m'ws://localhost:36257/hero'[39m,
  code: [32m'DisconnectedError'[39m
}

NN-Binary avatar Jun 12 '24 13:06 NN-Binary

I've also tried to create another tab first then browse with that tab, automated fake click too... all of them crash the instance right away, except when it's done manually, then it works.

NN-Binary avatar Jun 13 '24 09:06 NN-Binary

Now that Google has disabled the --load-extension flag, this is not doable in the same way anymore. I've gotten this to work, at least when incognito is disabled:

import { CorePlugin } from '@ulixee/hero-plugin-utils'
import type IBrowser from '@ulixee/unblocked-specification/agent/browser/IBrowser'
import type IBrowserContext from '@ulixee/unblocked-specification/agent/browser/IBrowserContext'
import type IBrowserUserConfig from '@ulixee/unblocked-specification/agent/browser/IBrowserUserConfig'

export class UblockPlugin extends CorePlugin {
    static get id() {
        return 'ublock-plugin'
    }

    async onNewBrowser(browser: IBrowser, userConfig: IBrowserUserConfig) {
        const idx = browser.engine.launchArguments.findIndex(val => val === '--disable-extensions')
        if (idx < 0) throw new Error('Cannot find disable extensions flag')
        browser.engine.launchArguments.splice(idx, 1)

        browser.engine.launchArguments.push('--enable-unsafe-extension-debugging')
    }

    async onNewBrowserContext(context: IBrowserContext) {
        await context.browser.devtoolsSession.send('Extensions.loadUnpacked', { path: 'PATH_TO_UBLOCK' })
    }
}

I tried writing some code to activate the extension in incognito mode, but then the extension just appeared to be broken, with most of the UI missing, and seemingly not blocking anything. Might work with other extensions?

Mild garbage code to enable extension with incognito mode (broken for me with uBlock, might be fixable)

First, here's a modified version of the plugin above. Note the PATH_TO_UBLOCK and JS_FROM_BELOW placeholders

import { CorePlugin } from '@ulixee/hero-plugin-utils'
import type IBrowser from '@ulixee/unblocked-specification/agent/browser/IBrowser'
import type IBrowserContext from '@ulixee/unblocked-specification/agent/browser/IBrowserContext'
import type IBrowserUserConfig from '@ulixee/unblocked-specification/agent/browser/IBrowserUserConfig'
import type Protocol from 'devtools-protocol'

export class UblockPlugin extends CorePlugin {
    static get id() {
        return 'ublock-plugin'
    }

    async onNewBrowser(browser: IBrowser, userConfig: IBrowserUserConfig) {
        console.debug('New browser launching, modifying launch arguments...')
        const idx = browser.engine.launchArguments.findIndex(val => val === '--disable-extensions')
        if (idx < 0) throw new Error('Cannot find disable extensions flag')
        browser.engine.launchArguments.splice(idx, 1)

        browser.engine.launchArguments.push('--enable-unsafe-extension-debugging')
    }

    async onNewBrowserContext(context: IBrowserContext) {
        console.debug('New browser context created, enabling extension...')
        const resp = await context.browser.devtoolsSession.send('Extensions.loadUnpacked', { path: 'PATH_TO_UBLOCK' })
        const page = await context.newPage()
        await page.navigate(`chrome://extensions/?id=${resp.id}`)

        console.debug('Waiting for extension settings page to finish loading...')

        await ((): Promise<void> => new Promise((resolve, reject) => {
            const timeout = setTimeout(() => {
                page.devtoolsSession.off('Page.frameStoppedLoading', eventListener)
                reject(new Error('Timed out waiting for frame to stop loading'))
            }, 1500)

            const eventListener = (event: Protocol.Page.FrameStoppedLoadingEvent | undefined) => {
                if (event?.frameId !== page.mainFrame.id) return
                resolve()
                clearTimeout(timeout)
                page.devtoolsSession.off('Page.frameStoppedLoading', eventListener)
            }

            page.devtoolsSession.on('Page.frameStoppedLoading', eventListener)
        }))()

        console.debug('Injecting script to enable extension...')

        await page.evaluate('JS_FROM_BELOW')

        console.debug('Script injected, awaiting completion...')

        let attempts = 0
        while (true) {
            if (attempts > 20) throw new Error('Timed out waiting for extension to enable')
            attempts++

            if (page.mainFrame.url === 'about:blank?extension-enabled') break

            await new Promise(resolve => setTimeout(resolve, 250))
        }

        console.debug('Finished enabling extension, closing temporary page!')
        await page.close()
    }
}

JS to evaluate (JS_FROM_BELOW):

// @ts-check

(async () => {
    const successRedirect = 'about:blank?extension-enabled'

    // In my implementation, the script would also be run after the redirect? Not really sure why.
    if (window.location.href === successRedirect) return
    else if (!window.location.href.startsWith('chrome://extensions/?id')) throw new Error(`Not on extension options page?? ${window.location.href}`)

    /**
     * 
     * @param {Element} extToggleRow 
     * @param {boolean} value 
     */
    const toggle = (extToggleRow, value) => {
        const extToggleRowSR = extToggleRow.shadowRoot
        if (!extToggleRowSR) throw new Error('Could not get extToggleRow.shadowRoot')

        const toggle = extToggleRowSR.querySelector('#crToggle')
        if (!toggle) throw new Error('Could not get toggle')

        if (!('checked' in toggle) || !('click' in toggle) || typeof toggle.click !== 'function') throw new Error('Toggle does not have required properties')

        if (toggle.checked !== value) toggle.click()
    }

    /**
     * 
     * @param {number} time 
     * @returns 
     */
    const sleep = (time) => new Promise(resolve => setTimeout(resolve, time))

    const enable = async (attempt = 0) => {
        try {
            const extManager = document.querySelector('extensions-manager')
            if (!extManager) throw new Error('Could not get extManager')

            const extManagerSR = extManager.shadowRoot
            if (!extManagerSR) throw new Error('Could not get extManager.shadowRoot')

            const viewManager = extManagerSR.getElementById('viewManager')
            if (!viewManager) throw new Error('Could not get viewManager')

            const extDetailView = viewManager.querySelector('extensions-detail-view')
            if (!extDetailView) throw new Error('Could not get extDetailView')

            const extDetailViewSR = extDetailView.shadowRoot
            if (!extDetailViewSR) throw new Error('Could not get extDetailView.shadowRoot')

            const incognitoToggleRow = extDetailViewSR.querySelector('extensions-toggle-row#allow-incognito')
            if (!incognitoToggleRow) throw new Error('Could not get incognitoToggleRow')
            toggle(incognitoToggleRow, true)

            await sleep(500)

            const pinToToolbarToggleRow = extDetailViewSR.querySelector('extensions-toggle-row#pin-to-toolbar')
            if (!pinToToolbarToggleRow) throw new Error('Could not get pinToToolbarToggleRow')
            toggle(pinToToolbarToggleRow, true)
        } catch (err) {
            if (attempt > 10) throw err
            await sleep(100)
            return await enable(attempt + 1)
        }
    }

    await enable()
    await sleep(250)
    window.location.href = successRedirect
})()

NOTE: If you're using Typescript, you will get complaints that the Extensions.loadUnpacked command does not exist. This is because the devtools protocol included with Ulixee is quite old. If using Yarn, it's quite easy to fix this, just do something like yarn set resolution devtools-protocol@npm:^0.0.1137505 npm:^0.0.1541592

jensmogens avatar Nov 11 '25 14:11 jensmogens