S
S
Sergey Sokolov2018-12-05 10:38:17
JavaScript
Sergey Sokolov, 2018-12-05 10:38:17

How to simulate a click in the react WhatsApp web application from the browser console?

The WhatsApp web client is implemented, it seems, in React.
How can I simulate a click on a contact on the left from the browser console to open a dialog with him?
The component is rendered as multiple nested divs. The clicks seem to be catching above, on the first child component under div#app
Tried it in different ways, for example:

var el = document.querySelectorAll('div._2wP_Y')[3];
// попытка
el.dispatchEvent(
  new Event("mousedown", {bubbles: true})
); // в т.ч. с указанием других свойств: target, currentTarget

// попытка не пытка
el.click();

But it doesn't trigger a click in the app - nothing happens.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Sokolov, 2018-12-05
@sergiks Asker

It looks like it's not about React, but about the fact that WhatsApp web began to check the isTrusted property of events.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question