Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

102
Views
¿Cómo puedo obtener el registro de la consola del sitio web actual abierto en un iframe o página usando extensiones de Chrome?

¿Cómo puedo abrir los registros de la consola del sitio web actual en un iframe o página usando extensiones de Chrome? Estoy usando el protocolo de depuración de Chrome para eso, pero puedo calcular los registros

 chrome.tabs.query({ currentWindow: true, active: true }, function (tabs) { console.log("tabs--->", tabs); console.log("tabs[0].id", tabs[0].id); chrome.debugger.attach({ tabId: tabs[0].id }, "1.1", () => { if (chrome.runtime.lastError) { console.log("runtime.lastError", chrome.runtime.lastError.message); return; } console.log("Debugger attached"); }); chrome.debugger.sendCommand({ tabId: tabs[0].id }, "Console.enable", () => { if (chrome.runtime.lastError) { console.log("runtime.lastError", chrome.runtime.lastError.message); return; } console.log("Log enabled and result"); }); const config = { source: "javascript", level: "log", text: "console.log('hello world')", }; chrome.debugger.sendCommand({ tabId: tabs[0].id }, "Console.ConsoleMessage", config, () => { if (chrome.runtime.lastError) { console.log("runtime.lastError", chrome.runtime.lastError.message); return; } console.log("Log enabled and result"); }); });

Probé este código anterior, arroja un error Console.ConsoleMessage not found

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Para obtener todos los registros

 chrome.debugger.getTargets((result) => console.log(result) )

Aquí estamos agregando un detector de eventos

 chrome.debugger.onEvent.addListener(onEvent);

chrome.tabs.query le da la pestaña actual Para habilitar los registros, tenemos que enviar Comando de Log.enable

 chrome.tabs.query({ currentWindow: true, active: true }, function (tabs) { // you can even attach tabId or targetId chrome.debugger.attach( { targetId: "FC33D8084B688E98F5929B90326E3A27" }, "1.3", () => { if (chrome.runtime.lastError) { console.log("runtime.lastError", chrome.runtime.lastError.message); return; } console.log("Debugger attached"); } ); chrome.debugger.sendCommand( { targetId: "FC33D8084B688E98F5929B90326E3A27" }, "Log.enable", () => { if (chrome.runtime.lastError) { console.log("runtime.lastError", chrome.runtime.lastError.message); return; } console.log("Log enabled and result"); } ); }); function onEvent(debuggeeId, message, params) { // Here you can get the logs console.log("params", params); }
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!