Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

139
Visualizações
How to execute script targeting another extension?

From within a Chrome extension, is there any way I can execute a script into another open extension? I just want to click a specific button whenever a different extension opens.

I tried using chrome scripting APIs:

chrome.scripting.executeScript({
   target: { tabId: tab.id }, // tab id relative the other open extension
   function: injectIntoAnotherExtension
});

function injectIntoAnotherExtension() {
    document.getElementById('some-button').click();
}

At first I got the error:

Error: Cannot access a chrome-extension:// URL of different extension

After enabling the Extensions on chrome:// URLs flag (chrome://flags/#extensions-on-chrome-urls), I now get:

Error: Cannot access contents of url "chrome-extension://foo/bar/xyz.html". Extension manifest must request permission to access this host.

Here are my manifest permissions, which should allow all urls:

"host_permissions": [
   "<all-urls>"
]

I also tried with *://*/* or chrome-extensions://*/* but with no success.

Related questions: this and this.

Any way around it? Or is there any other way to automatically click a button in another running extension?

Thanks!

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Thanks to @wOxxOm, I got it working with:

chrome.debugger.attach({
   tabId: tab.id
}, '1.0', function() {
   chrome.debugger.sendCommand({
      tabId: tab.id
   }, "Runtime.evaluate", { expression: 
      "document.getElementById('some-button').click();" 
   }, function(response) {
      console.log(response);
   });
});
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda