Index: chrome/test/pyautolib/pyauto.py |
=================================================================== |
--- chrome/test/pyautolib/pyauto.py (revision 78898) |
+++ chrome/test/pyautolib/pyauto.py (working copy) |
@@ -754,6 +754,33 @@ |
} |
self._GetResultFromJSONRequest(cmd_dict) |
+ def SendWebkitKeyEvent(self, key_code, tab_index=0, windex=0): |
dennis_jeffrey
2011/03/22 23:28:53
For consistency in naming variables, I recommend t
dyu1
2011/03/24 19:46:51
From the pydocs for pyauto most of the variables f
dennis_jeffrey
2011/03/25 16:56:14
Maybe we should change them all then >:-).
Just k
|
+ """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) |
dennis_jeffrey
2011/03/22 23:28:53
Swap the descriptions for the "windex" and "tab_in
dyu1
2011/03/24 19:46:51
Done.
|
+ """ |
+ cmd_dict = { |
+ 'command': 'SendWebkitKeyEvent', |
+ 'type': 0, # kRawKeyDownType |
+ 'text': '', |
+ 'isSystemKey': False, |
+ 'unmodifiedText': '', |
+ 'nativeKeyCode': 0, |
+ 'windowsKeyCode': key_code, |
+ 'modifiers': 0, |
+ 'windex': windex, |
+ 'tab_index': tab_index, |
+ } |
+ # Sending two requests, one each for "key down" and "key up". |
+ self._GetResultFromJSONRequest(cmd_dict) |
+ cmd_dict['type'] = 3 # kKeyUpType |
+ self._GetResultFromJSONRequest(cmd_dict) |
+ |
def WaitForAllDownloadsToComplete(self, windex=0): |
"""Wait for all downloads to complete. |