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

202
Vistas
NOT able to use javascriptexecutor for clicking on LogIn button (tried querySelector, getElementsByClassName but failed)

I am trying to do Selenium with Java casestudy on the web site https://www.demoblaze.com/index.html,

Steps:

  1. Go to https://www.demoblaze.com/index.html
  2. clcik on 'Log in' and enter username and Password, finally click on Log in button.

Issue:

As findElement is NOT working even with WebDriverWait on the Log In popup, I have tried JavaScriptExecutor which is working fine with Username and Password.

js.executeScript("document.getElementsByTagName('input')[4].value="+"'"+user+"'"); js.executeAsyncScript("document.getElementById('loginpassword').value="+"'"+pass+"'");

However when I tried on Log in button using getElementsByClassName, querySelector, it did not work. Please help.

FYIP: None of the below working for me.

JavascriptExecutor js;

js.executeAsyncScript("arguments[0].click();","document.evaluate('//button[text()='Log in']', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;");

js.executeScript("document.querySelector('button').onclick = 'logIn()'.click();");

js.executeScript("document.getElementsByClassName('btn btn-primary')[2].click()");

about 4 years ago · Santiago Gelvez
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