Skip to content

Instantly share code, notes, and snippets.

@mghadam
Created March 7, 2023 16:58
Show Gist options
  • Save mghadam/c7e0f2ec05e5a8fb2a68013697977054 to your computer and use it in GitHub Desktop.
Save mghadam/c7e0f2ec05e5a8fb2a68013697977054 to your computer and use it in GitHub Desktop.
Pressing Enter/Tab Keys using Chrome debugging protocol
# https://chromedevtools.github.io/devtools-protocol/tot/Input/#method-dispatchKeyEvent
# https://github.com/ChromeDevTools/devtools-protocol/issues/45#issuecomment-850953391
# https://groups.google.com/g/chrome-debugging-protocol/c/DQxlrBNSC9w
# Pressing the Tab Key
tab.call_method("Input.dispatchKeyEvent", type="rawKeyDown", windowsVirtualKeyCode=9, key="Tab", unmodifiedText="\t", text="\t")
# Pressing the Enter key
tab.call_method("Input.dispatchKeyEvent", type="rawKeyDown", windowsVirtualKeyCode=13, key="Enter", unmodifiedText="\r", text="\r")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment