Fix newline characters not being typed into textareas - #61
Conversation
|
to fix this issue, should we be sending \uE006 instead? including a link to where to relavent sections of the WebDriver or WebDriver BiDi spec would also be helpful to folks reading this later. |
WebDriver BiDi requires carriage return (\r) to produce the Enter key, not newline (\n). Text containing \n was being typed without line breaks. - Add NormalizeKeyChar helper in internal/bidi/keys.go - Apply conversion in both input.go (CLI) and router.go (WebSocket API) - Add newline tests for JS async API and CLI
Rename NormalizeKeyChar to ConvertToKeyChar to better reflect its purpose: mapping string literal characters (e.g. \n) to their WebDriver BiDi keyboard equivalents (e.g. \uE006 Return key). Also switch from \r to the canonical WebDriver Return key code.
70de1bd to
b2eeaae
Compare
|
I think you're right that Addressed in |
A literal newline is not a key. WebDriver addresses Enter through the normalized key value , so typing "123\n456" sent '\n' as a key value the browser ignored and the textarea received "123456". Original patch by Kevin Simler in #61. Rebased: the second call site moved from internal/proxy/router.go to internal/api/handlers_interaction.go when proxy was renamed to api (e61a1ed).
The original tests drove https://seleniumbase.io/demo_page. Live external sites stall and wedge the suite, so they now use the shared test server, which gains a textarea fixture on /inputs. Also covers element.type() in the JS client, which the CLI tests do not reach, and updates CLICKER to VIBIUM after the binary rename (9bc9c17).
|
Landed in #299, with your commit intact. Thanks for the fix, and sorry it sat this long. Your diagnosis was right and the patch needed no change. Only the surroundings had moved in the meantime: The one thing I rewrote was the tests, which drove Worth noting your two-case split was well chosen. Against the unpatched binary the carriage-return case passes and the newline case fails, so one is a regression guard for behaviour that already worked and the other is the actual bug. |
WebDriver BiDi requires carriage return (\r) to produce the Enter key, not newline (\n). Text containing \n was being typed without line breaks / line breaks were being dropped.