| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import ctypes | 5 import ctypes |
| 6 import json | 6 import json |
| 7 | 7 |
| 8 class ChromeDriverException(Exception): | 8 class ChromeDriverException(Exception): |
| 9 pass | 9 pass |
| 10 class UnknownCommand(ChromeDriverException): | 10 class UnknownCommand(ChromeDriverException): |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 def _ExecuteSessionCommand(self, name, params={}): | 68 def _ExecuteSessionCommand(self, name, params={}): |
| 69 return self._ExecuteCommand(name, params, self._session_id)['value'] | 69 return self._ExecuteCommand(name, params, self._session_id)['value'] |
| 70 | 70 |
| 71 def Load(self, url): | 71 def Load(self, url): |
| 72 self._ExecuteSessionCommand('get', {'url': url}) | 72 self._ExecuteSessionCommand('get', {'url': url}) |
| 73 | 73 |
| 74 def ExecuteScript(self, script, *args): | 74 def ExecuteScript(self, script, *args): |
| 75 return self._ExecuteSessionCommand( | 75 return self._ExecuteSessionCommand( |
| 76 'executeScript', {'script': script, 'args': args}) | 76 'executeScript', {'script': script, 'args': args}) |
| 77 | 77 |
| 78 def SwitchToFrame(self, id_or_name): |
| 79 self._ExecuteSessionCommand('switchToFrame', {'id': id_or_name}) |
| 80 |
| 81 def SwitchToFrameByIndex(self, index): |
| 82 self.SwitchToFrame(index) |
| 83 |
| 84 def SwitchToMainFrame(self): |
| 85 self.SwitchToFrame(None) |
| 86 |
| 78 def Quit(self): | 87 def Quit(self): |
| 79 """Quits the browser and ends the session.""" | 88 """Quits the browser and ends the session.""" |
| 80 self._ExecuteSessionCommand('quit') | 89 self._ExecuteSessionCommand('quit') |
| OLD | NEW |