test(webdriver): wait for form navigation with BiDi attached

This commit is contained in:
ldm0
2026-10-05 05:16:44 +08:00
committed by Donough Liu
parent c3b24ea097
commit fc2a45a9eb
@@ -108,7 +108,10 @@ async fn websocket_bidi_attached_classic_session_title_waits_for_script_triggere
"POST",
&format!("/session/{session_id}/execute/sync"),
json!({
"script": "document.querySelector('form').submit(); return 'submitted';",
// Form submission plans a later DOM task. Wait for navigation to
// start so the title command tests an in-flight load while BiDi
// is attached, rather than racing the planned submission task.
"script": "return new Promise(resolve => { navigation.addEventListener('navigate', () => resolve('submitted'), { once: true }); document.querySelector('form').submit(); });",
"args": []
}),
)