| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 response_json = ctypes.string_at(response_data, response_size.value) | 61 response_json = ctypes.string_at(response_data, response_size.value) |
| 62 self._lib.Free(response_data) | 62 self._lib.Free(response_data) |
| 63 response = json.loads(response_json) | 63 response = json.loads(response_json) |
| 64 if response['status'] != 0: | 64 if response['status'] != 0: |
| 65 raise _ExceptionForResponse(response) | 65 raise _ExceptionForResponse(response) |
| 66 return response['value'] | 66 return response['value'] |
| 67 | 67 |
| 68 def _ExecuteSessionCommand(self, name, params={}): | 68 def _ExecuteSessionCommand(self, name, params={}): |
| 69 return self._ExecuteCommand(name, params, self._session_id) | 69 return self._ExecuteCommand(name, params, self._session_id) |
| 70 | 70 |
| 71 def Load(self, url): |
| 72 self._ExecuteSessionCommand('get', {'url': url}) |
| 73 |
| 71 def Quit(self): | 74 def Quit(self): |
| 72 """Quits the browser and ends the session.""" | 75 """Quits the browser and ends the session.""" |
| 73 self._ExecuteSessionCommand('quit') | 76 self._ExecuteSessionCommand('quit') |
| OLD | NEW |