Skip to content

Instantly share code, notes, and snippets.

@Davis-3450
Last active August 7, 2025 05:12
Show Gist options
  • Save Davis-3450/804f8622e0f71a307edabfe60e64a257 to your computer and use it in GitHub Desktop.
Save Davis-3450/804f8622e0f71a307edabfe60e64a257 to your computer and use it in GitHub Desktop.
// 1) Abre el diálogo de compartir
const openBtn = document.querySelector('div[role="button"][aria-label="Send this to friends or post it on your profile."]');
if (openBtn) {
const e1 = new MouseEvent('click', {bubbles: true, cancelable: true, view: window});
openBtn.dispatchEvent(e1);
// 2) Espera un momento a que aparezca el botón “Share now”
setTimeout(() => {
const shareBtn = document.querySelector('div[role="button"][aria-label="Share now"]');
if (shareBtn) {
const e2 = new MouseEvent('click', {bubbles: true, cancelable: true, view: window});
shareBtn.dispatchEvent(e2);
} else {
console.warn('Share now no encontrado');
}
}, 500);
} else {
console.warn('Botón de abrir diálogo no encontrado');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment