Add context support to InteractiveBrowser methods #86
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
None of the
InteractiveBrowsermethods (Navigate,Screenshot,Cookies,MouseClick, etc.) accept acontext.Contextor have timeouts. If the Playwright process crashes or the remote server becomes unresponsive, these operations block forever.This is a significant issue for the captcha proxy system in Mort, where a hung Playwright operation causes the entire captcha session to appear frozen. The user sees a stalled browser with no recourse but restarting the bot.
Current Workaround
A watchdog timer in the captcha proxy's screenshot loop detects when no successful screenshot has been produced for 30 seconds and force-closes the session. This is a blunt workaround — ideally each operation would respect a context/timeout natively.
Proposed Change
Add
context.Contextas the first parameter toInteractiveBrowsermethods, or add timeout variants:This would be a breaking API change. An alternative is adding a
SetTimeout(d time.Duration)method or aWithContext(ctx context.Context) InteractiveBrowserwrapper.Related
Filed from mort issue steve/mort#1159 (captcha proxy reliability overhaul, Bug 4).