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

227
Visualizações
Change event doesn't work in console (Safari and Chrome) on some sites

I've been working on automation of user events for some stores but got stuck on cart page for https://shop.advanceautoparts.com/. I've been trying to fire any possible event on input field but it doesn't do same as user inputing data manually. Change event is detected on input but is there any additional events that making "Apply" button usable?

I've been trying with both jQuery and vanilla JS but nothing seems to work.

$(document).ready(function() {
    $('input[name="promoCode"]').blur();
     $('input[name="promoCode"]').focus(); 
    $('input[name="promoCode"]').attr('value','Example')[0].dispatchEvent(new Event('change', { bubbles: true }));
    $('input[name="promoCode"]').val('Example1')[0].dispatchEvent(new Event('change', { bubbles: true }));
    $('input[name="promoCode"]').blur();
          setTimeout( function () { 
    $('button[aria-label="Apply"]').removeAttr('disabled');
            $('button[aria-label="Apply"]').get(0).dispatchEvent(new MouseEvent('click', { view: window, bubbles: true, cancelable: true }))
          }, 100);
    setTimeout( function () { 
    $('button[aria-label="Apply"]').removeAttr('disabled');
            $('button[aria-label="Apply"]').get(0).dispatchEvent(new MouseEvent('mousedown', { view: window, bubbles: true, cancelable: true }))
          }, 200);
    setTimeout( function () { 
    $('button[aria-label="Apply"]').removeAttr('disabled');
            $('button[aria-label="Apply"]').click();
          }, 300);
 });

The click Event shouldn't be the issue as when I input something maually and fire

$('button[aria-label="Apply"]').click();

then everything is processing normally. Any idea?

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