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

127
Vistas
Watir Click JS Button

I can't seem to get past a button in a landing page. Here is the JS element with parent nodes:

<div class="modal-body-content callfor-popup">
  <h3>Welcome | Bienvenue</h3>

  <p class="body_M_normal" aria-level="4" role="heading">Please select a language | Veuillez sélectionner une langue</p>

  <div class="small_btn lcbo_cookie">
    <a class="body_M_normal" href="https://www.lcbo.com/en/stores/store/redirect/___store/en/___from_store/en/uenc/aHR0cHM6Ly93d3cubGNiby5jb20vZW4v/">English</a>
  </div>

  <div class="small_btn lcbo_cookie">
    <a class="body_M_normal" href="https://www.lcbo.com/en/stores/store/redirect/___store/fr/___from_store/en/uenc/aHR0cHM6Ly93d3cubGNiby5jb20vZnIv/">Français</a>
  </div>

  <hr>

  <p class="caption_xxs_noletterspace">
    You must be 19 years of age to purchase alcohol. Please note that we only deliver in Ontario / Vous devez avoir au moins 19 ans pour acheter de l'alcool. Veuillez noter que nous ne livrons pas à l'extérieur de l’Ontario.
  </p>
</div>

This is what I am currently trying:

    puts '1' if a.element(visible_text: 'English').exist?
    puts '2' if a.link(visible_text: 'English').exist?
    puts '3' if a.button(text: 'English').exist?
    puts '4' if a.link(visible_text: 'English').exist?
    puts '5' if a.element(visible_text: 'English').exist?

    a.button(text: 'English').click
    a.element(visible_text: 'English').click
    a.link(visible_text: 'English').click
    
    puts "clicks finished"

1, 2, 4 and 5 show up, indicating Watir knows they are there and exist. I can't seem to click that element though. It's not a formal HTML button, so that's why I'm trying several elements.

Is there a better way of dealing with such JS elements? I'm not sure how to focus on the English option.

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