Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

210
Vistas
Setting input value for twitter login page not working with JavaScript using Chrome Extension

I am trying to code an auto login Chrome extension but I am unable to fill the inputs for Twitter. And there are 2 problems I am facing:

  1. although I have set my content.js to run at the end of document in manifest.json it does not wait for Twitter to load completely and then inject the content.js.
"content_scripts": [
    {
      "run_at": "document_end",
      "js": ["js/lib/jquery-3.5.1.min.js","js/app/content.js"],
      "matches": ["https://twitter.com/i/flow/login"]
    }
]
  1. I manage to wait for login page using setTimeout() but this time when I change the input value to my username and click next using code it throws the error username not found but manually it totally works.
setTimeout(()=> document.querySelector('input[type="text"]').value = "username" , 2500 );
setTimeout(()=> document.querySelectorAll('div[role="button"]')[2].click(),3500);
setTimeout(()=> document.querySelector('input[type="password"]').value = "password",4000);
setTimeout(()=> document.querySelectorAll('div[role="button"]')[2].click(),4500);

Can you please tell me what I am doing wrong? I even tried these codes manually from console in developer mode of Chrome but they did not work (I am only facing this problem with Twitter and my code works perfectly fine with other websites).

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda