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

157
Visualizações
simulating keypress on Input on webpage using chrome.debugger.sendCommand

I'm working on a TamperMonkey script to automate a few things for me on a webpage.

On this webpage there is also an input-field which is giving me some headaches. I can enter values in the field, but it doesn't get validated and the submit button remains disabled.

I can select the input programmatically by using

elmtsInputs[0].select();

after which I can enter the value from my keyboard without any problem.

However if I try:

elmtsInputs[0].value = "0.5";

The value 0.5 appears briefly before it's being reset again to the default 0.0

So there is some sort of validation happening on the input-field that notices that the value wasn't typed. Also when I type in an unauthorized value (basically any value greater than 1) it also shows a validation message to say the value is incorrect. So there is definitely validation happening.

I have tried multiple dispatchEvents but none of them worked. After searching online I came across multiple sources that the problem is related to the isTrusted:false issue where input coming from scripts are not trusted but keyboard input is.

When trying to look if there was any way to bypass this, I found some examples where the use of the Chrome Debugger was used a solution.

chrome.debugger.attach(target, "1.2", function() {
   chrome.debugger.sendCommand(target, "Input.dispatchMouseEvent", arguments)
})

However, I haven't found any useable example on how to implement this.

Can someone shed some light on how this should be implemented? Thank you.

about 4 years ago · Juan Pablo Isaza
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