A
A
AlbMikh2020-05-13 10:23:15
JavaScript
AlbMikh, 2020-05-13 10:23:15

What to do if actions on the page are not performed after a program click, when if you click manually everything works?

Hello! I am writing an extension for the Browser, which should interact with the site vk.com . The extension should click on the element with the class "top_audio_player_title" 5ebba03877ec6190646505.png (after clicking on it, a menu pops up with your current music playlist). The problem is that when you click manually - everything works, but if you click through .click() , the menu will not pop up. With other elements on the page, everything works fine and is clickable.

Thanks in advance!!!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
GrayHorse, 2020-05-13
@AlbMikh

document.querySelector("#top_audio_player").dispatchEvent(new MouseEvent("mousedown"));

I
Ivan Ivanov, 2020-05-13
@maksim_fix

Most likely, that site has protection against such "software" clicks. Since this is how you can make a
PS bot: just made a click (.click()) in the console, everything works, it means something is wrong with your extension, or VK is blocking clicks

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question