Home > Software design >  Hover over photos in whatsapp web to activate child element to click?
Hover over photos in whatsapp web to activate child element to click?

Time:12-10

My goal is to select all photos in enter image description here

You can check out your own whatsapp web version by

  1. going to web.whatsapp.com
  2. authenticate
  3. open up a chat
  4. click on top of the chat
  5. click on media

CodePudding user response:

If it has to do something with the mouseover (or maybe the mouseenter) event, this might be worth a shot:

const mouseoverEvent = new Event('mouseover');
document.querySelectorAll("._23fpc").forEach(s => s.dispatchEvent(mouseoverEvent));

If it works, you can go on with the code you provided.

CodePudding user response:

Since you've got this in the jQuery category, here's a JQ way of approaching it. The unknown bit is what the mouseover is doing... it might be triggering some kind of async event before it writes to the page. I have put in a little delay after mouseover which you might need to edit

$("._23fpc").each(function () {
  $(this).trigger('mouseenter');
  doMO($(this));
})

function doMO($el) {
 setTimeout(() => {
   $el.trigger('click');
 }, 100)
}
  • Related