Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions packages/mcp-server/src/driver/scripts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ export function buildTypeScript(selector: string, text: string, strategy?: strin
var element = window.__MCP__.resolveRef(selector, strategy);
if (!element) throw new Error('Element not found: ' + selector);

element.focus();

// Use native prototype setter to bypass React's value tracker
var proto = element.tagName === 'TEXTAREA'
? HTMLTextAreaElement.prototype
Expand Down
3 changes: 0 additions & 3 deletions packages/mcp-server/src/driver/scripts/keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ function typeText(params) {
throw new Error(`Element not found: ${selector}`);
}

// Focus the element
element.focus();

// Set the value
element.value = text;

Expand Down
5 changes: 4 additions & 1 deletion packages/mcp-server/tests/unit/webview-interactions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,11 @@ describe('Webview Interactions Unit Tests', () => {

const result = await keyboard({ action: 'type', selectorOrKey: '#input', textOrModifiers: 'Hello World' });

const callArg = mockExecuteInWebview.mock.calls[0][0] as string;

expect(mockExecuteInWebview).toHaveBeenCalledOnce();
expect(mockExecuteInWebview).toHaveBeenCalledWith(expect.stringContaining('__MCP__'), undefined, undefined);
expect(callArg).toContain('__MCP__');
expect(callArg).not.toContain('.focus(');
expect(result).toContain('Typed');
});

Expand Down