Skip to content

armgit / moli

Public Imported from GitHub
0

Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust

fix(playground): harden ChatGPT password form detection

ldm0194698bd6a1d
diff --git a/moli-playground/chatgpt/chatgpt_cdp_demo.py b/moli-playground/chatgpt/chatgpt_cdp_demo.py
index fd1f11e65..3c80687be 100644
--- a/moli-playground/chatgpt/chatgpt_cdp_demo.py
+++ b/moli-playground/chatgpt/chatgpt_cdp_demo.py
@@ -91,8 +91,11 @@ CHATGPT_HELPER_JS = r"""
if (el.disabled) return false;
if (el.getAttribute?.('disabled') !== null) return false;
if (el.type === 'hidden') return false;
+ if (String(el.name || '').toLowerCase() === 'hiddenpassword') return false;
if (el.getAttribute?.('aria-disabled') === 'true') return false;
if (el.getAttribute?.('hidden') !== null) return false;
+ const style = globalThis.getComputedStyle?.(el);
+ if (style?.display === 'none' || style?.visibility === 'hidden') return false;
return true;
}
@@ -663,6 +666,9 @@ CHATGPT_HELPER_JS = r"""
installPasswordSubmitDiagnostics(input);
setControlValue(input, password);
const reactSubmit = submitReactForm(input);
+ if (reactSubmit) {
+ return { ok: true, reactSubmit: true, clickedSubmit: false };
+ }
const submit = findSubmitButton();
if (submit) {
clickElement(submit);