From ddeed7bde5b8889a2f8dfffd8185c4089aeb2a22 Mon Sep 17 00:00:00 2001 From: Alex Rudenko Date: Sat, 17 Jan 2026 07:58:02 +0100 Subject: [PATCH 1/2] fix: increase timeouts for long text input --- src/tools/input.ts | 9 ++++++++- tests/tools/input.test.ts | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/tools/input.ts b/src/tools/input.ts index bfbcf6b66..60fea0c98 100644 --- a/src/tools/input.ts +++ b/src/tools/input.ts @@ -159,7 +159,13 @@ async function fillFormElement( if (aXNode && aXNode.role === 'combobox') { await selectOption(handle, aXNode, value); } else { - await handle.asLocator().fill(value); + // Increase timeout for longer input values. + const textLengthIn1kChars = Math.floor(value.length / 1_000); + const timeoutPer1kChars = 5_000; // ms + const fillTimeout = + context.getSelectedPage().getDefaultTimeout() + + textLengthIn1kChars * timeoutPer1kChars; + await handle.asLocator().setTimeout(fillTimeout).fill(value); } } finally { void handle.dispose(); @@ -183,6 +189,7 @@ export const fill = defineTool({ }, handler: async (request, response, context) => { await context.waitForEventsAfterAction(async () => { + await context.getSelectedPage().keyboard.type(request.params.value); await fillFormElement( request.params.uid, request.params.value, diff --git a/tests/tools/input.test.ts b/tests/tools/input.test.ts index cb8ae7111..0150671c3 100644 --- a/tests/tools/input.test.ts +++ b/tests/tools/input.test.ts @@ -301,6 +301,38 @@ describe('input', () => { assert.strictEqual(selectedValue, 'v2'); }); }); + + it('fills out a textarea with long text', async () => { + await withMcpContext(async (response, context) => { + const page = context.getSelectedPage(); + await page.setContent(html`