Skip to content

Conversation

@jotaaave
Copy link

🔧 Fix: Script compatibility with new DOM


🇺🇸 EN — Description

This pull request fixes issues that caused the script to stop working for many users after recent DOM changes.

🔴 Problems Identified

1️⃣ “Chat not open” error

This message was misleading.
It was not related to the conversation actually being closed, but rather to the script failing to locate the chat element due to changes in the DOM structure.

✅ The selector was updated to properly support the new DOM.


2️⃣ Cannot read properties of null (reading 'click')

The send button was returning null because:

  • The button’s DOM structure changed
  • The query was limited to a specific main container
  • The script attempted to call .click() on a non-existent element

✅ The main limitation was removed and button existence verification was added before calling .click().


✨ Changes

Before

Before 1
Before 2

After

After 1
After 2


🇧🇷 PT — Descrição

Este pull request corrige problemas que fizeram o script parar de funcionar para muitos usuários após mudanças recentes no DOM.

🔴 Problemas Identificados

1️⃣ Erro “Conversa não está aberta”

Essa mensagem era enganosa.
Ela não indicava que a conversa estivesse fechada, mas sim que o script não conseguia localizar o chat devido à nova estrutura do DOM.

✅ O seletor foi ajustado para funcionar corretamente com o novo DOM.


2️⃣ Cannot read properties of null (reading 'click')

O botão de envio retornava null porque:

  • A estrutura do DOM do botão mudou
  • A busca estava limitada ao container main
  • O script tentava executar .click() em um elemento inexistente

✅ A limitação do main foi removida e foi adicionada uma verificação antes de executar o .click().


✨ Alterações

Antes

Antes 1
Antes 2

Depois

Depois 1
Depois 2

Updated the enviarScript function to adapt to changes in WhatsApp's DOM structure, ensuring the message sending process works correctly with the new button layout.
Updated the enviarScript function to work with the new WhatsApp message button and improved error handling.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant