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

105
Vistas
Javascript snippet in dev tools seems to not execute after a web page changes url

I'm very new to JavaScript and trying to automate a small test process in a browser (Sources - Snippets) with JavaScript, and it spans over several web pages, and I noticed that after a page reloads or a new page loads the subsequent code seems to not execute. Even if I set a big timeout. The code lines executed separately in the "console" tab of the dev tools work fine. So the question is: what shall I do to make them execute one after another in one snippet?

Here is just one step after which nothing seems to happen:

(function() {
  //Link   
  document.querySelector("#main-content > p:nth-child(6) > a").click(); // a click works, but the next line does not do anything even with a big timeout.

  //LOGIN FORM
  //User name
  setTimeout(() => {
    document.querySelector("form input[formcontrolname='benutzername']").value = 'xxxx'
  }, 3000); //when executed separately in the console, it works.
})()
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Got an answer from an expert: "When automating from the console, the code won't survive a page reload because the code is running in the document process, so when it changes the code is gone."

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