Skip to content

Instantly share code, notes, and snippets.

View mghadam's full-sized avatar

Mostafa Ghadamyari mghadam

View GitHub Profile
@mghadam
mghadam / gist:c7e0f2ec05e5a8fb2a68013697977054
Created March 7, 2023 16:58
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")