diff --git a/src/bot/captionsProcedure.ts b/src/bot/captionsProcedure.ts index 2098202..a79b1f3 100644 --- a/src/bot/captionsProcedure.ts +++ b/src/bot/captionsProcedure.ts @@ -277,10 +277,12 @@ export class CaptionsProcedure { const candidates = document.querySelectorAll( '[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"], button, li' ); - for (const el of candidates) { - const text = (el as HTMLElement).innerText?.toLowerCase() || ''; + const elArray = Array.from(candidates); + for (let i = 0; i < elArray.length; i++) { + const el = elArray[i] as HTMLElement; + const text = el.innerText?.toLowerCase() || ''; if (keywords.some(kw => text.includes(kw))) { - (el as HTMLElement).click(); + el.click(); return text; } }