interact.ts
1 /** 2 * Injected script for interactive fuzzing (clicking elements to trigger lazy loading) 3 */ 4 export async function interactFuzz() { 5 const sleep = (ms: number) => new Promise(r => setTimeout(r, ms)); 6 const clickables = Array.from(document.querySelectorAll( 7 'button, [role="button"], [role="tab"], .tab, .btn, a[href="javascript:void(0)"], a[href="#"]' 8 )).slice(0, 15); // limit to a small number to avoid endless loops 9 10 let clicked = 0; 11 for (const el of clickables) { 12 try { 13 const rect = el.getBoundingClientRect(); 14 if (rect.width > 0 && rect.height > 0) { 15 el.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window })); 16 clicked++; 17 await sleep(300); // give it time to trigger network 18 } 19 } catch {} 20 } 21 return clicked; 22 }