Index: chrome/test/pyautolib/pyauto.py |
=================================================================== |
--- chrome/test/pyautolib/pyauto.py (revision 78752) |
+++ chrome/test/pyautolib/pyauto.py (working copy) |
@@ -754,6 +754,32 @@ |
} |
self._GetResultFromJSONRequest(cmd_dict) |
+ def SendWebkitKeyEvent(self, key_code, tab_index=0, windex=0): |
Ilya Sherman
2011/03/18 23:17:11
I'd be very surprised if this functionality is not
dyu1
2011/03/21 18:42:35
PyAuto was never meant to interact with the web UI
|
+ """Send a webkit key event to the browser. |
+ |
+ Used to simulate key presses from the keyboard to interact with the browser. |
+ |
+ Args: |
+ key_code: the hex value associated with the keypress (virtual key code). |
+ windex: window index to work on. Defaults to 0 (first window) |
+ tab_index: tab index to work on. Defaults to 0 (first tab) |
+ """ |
+ cmd_dict = { |
+ 'command': 'SendWebkitKeyEvent', |
+ 'type': 0, # kRawKeyDownType |
+ 'text': '', |
+ 'isSystemKey': False, |
+ 'unmodifiedText': '', |
+ 'nativeKeyCode': 0, |
+ 'windowsKeyCode': key_code, |
+ 'modifiers': 0, |
+ 'windex': windex, |
+ 'tab_index': tab_index, |
+ } |
+ self._GetResultFromJSONRequest(cmd_dict) |
+ cmd_dict['type'] = 3 # kKeyUpType |
+ self._GetResultFromJSONRequest(cmd_dict) |
+ |
def WaitForAllDownloadsToComplete(self, windex=0): |
"""Wait for all downloads to complete. |