Uh oh!
There was an error while loading. Please reload this page.
chore(bidi): reimplement RawKeyboard.sendText() - #41637
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
f59dcb9 to
1343e6dCompare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Yury Semikhatsky (yury-s)
left a comment
There was a problem hiding this comment.
Looks good except for putting Bidi-specific script into a separate extension.
This implementation tries to emulate CDP's Input.insertText behavior more closely.
Are there any plans to have such method in Bidi protocol?
| return 'needsinput'; // Still need to input the value. | ||
| } | ||
| insertText(text: string): Element | undefined { |
There was a problem hiding this comment.
Since this is only used in Bidi, it should go in its own script/module. You can call browserContext.extendInjectedScript() to add extra logic.
1343e6d to
e25d3f6Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Yury Semikhatsky (@yury-s) I tried using to |
| return 'needsinput'; // Still need to input the value. | ||
| } | ||
| bidiInsertText?: (text: string) => Element | undefined; |
There was a problem hiding this comment.
can we avoid adding this to the main script? packages/injected/src/recorder/pollingRecorder.ts adds a rich API and doesn't leak any of it into the main InjectedScript, let's employ the same approach here.
There was a problem hiding this comment.
OK, I'll do that.
Yury Semikhatsky (yury-s)
commented
Jul 8, 2026
Hmm, doesn't fail for me when I run the test with this change (in chromium). Are you sure there are no other changes? |
Holger Benl (hbenl)
commented
Jul 9, 2026
I found the root cause (see #41706) and it's a very subtle race condition - the timing needs to be just right to trigger it, so it's not surprising that it's hard to reproduce (it's rather surprising that it reproduces so well on my machine, although I could get the test to pass by adding a delay of 1 millisecond to it). |
e25d3f6 to
d1bfcbaCompareTest results for "MCP"2 failed 7733 passed, 1248 skipped Merge workflow run. |
Test results for "tests 1"4 flaky49512 passed, 1161 skipped Merge workflow run. |
Yury Semikhatsky (yury-s)
commented
Jul 10, 2026
Holger Benl (@hbenl) bumping this up. Do you think the implementation could benefit from a native support of insert text in the Bidi protocol? Quick search didn't return any issues about it. |
3717f69
into
microsoft:mainUh oh!
There was an error while loading. Please reload this page.
Holger Benl (hbenl)
commented
Jul 13, 2026
I haven't found any significant downsides with this implementation but I've opened an issue to see if there's interest to add this to Bidi: w3c/webdriver-bidi#1133 |
Bidi doesn't have a protocol method corresponding to CDP's
Input.insertText, so this was emulated using keyboard actions. However, this emitskey*events that are not expected forKeyboard.insertText(), breaking several tests.This implementation tries to emulate CDP's
Input.insertTextbehavior more closely.Fixes the following tests:
page/page-fill.spec.ts:tests/page/page-keyboard.spec.ts: