| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library webdriver; | 5 library webdriver; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 import 'dart:json' as json; | 9 import 'dart:json' as json; |
| 10 | 10 |
| 11 part 'src/base64decoder.dart'; | 11 part 'src/base64decoder.dart'; |
| (...skipping 1149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1161 */ | 1161 */ |
| 1162 Future dismissAlert() => _post('dismiss_alert'); | 1162 Future dismissAlert() => _post('dismiss_alert'); |
| 1163 | 1163 |
| 1164 /** | 1164 /** |
| 1165 * Move the mouse by an offset of the specificed element. If no element is | 1165 * Move the mouse by an offset of the specificed element. If no element is |
| 1166 * specified, the move is relative to the current mouse cursor. If an | 1166 * specified, the move is relative to the current mouse cursor. If an |
| 1167 * element is provided but no offset, the mouse will be moved to the center | 1167 * element is provided but no offset, the mouse will be moved to the center |
| 1168 * of the element. If the element is not visible, it will be scrolled | 1168 * of the element. If the element is not visible, it will be scrolled |
| 1169 * into view. | 1169 * into view. |
| 1170 */ | 1170 */ |
| 1171 Future moveTo(String id, int x, int y) => | 1171 Future moveTo(String id, int x, int y) { |
| 1172 _post('moveto', { 'element': id, 'xoffset': x, 'yoffset' : y}); | 1172 Map json = {}; |
| 1173 if (id != null) { |
| 1174 json['element'] = id; |
| 1175 } |
| 1176 if (x != null) { |
| 1177 json['xoffset'] = x; |
| 1178 } |
| 1179 if (y != null) { |
| 1180 json['yoffset'] = y; |
| 1181 } |
| 1182 return _post('moveto', json); |
| 1183 } |
| 1173 | 1184 |
| 1174 /** | 1185 /** |
| 1175 * Click a mouse button (at the coordinates set by the last [moveTo] command). | 1186 * Click a mouse button (at the coordinates set by the last [moveTo] command). |
| 1176 * Note that calling this command after calling [buttonDown] and before | 1187 * Note that calling this command after calling [buttonDown] and before |
| 1177 * calling [buttonUp] (or any out-of-order interactions sequence) will yield | 1188 * calling [buttonUp] (or any out-of-order interactions sequence) will yield |
| 1178 * undefined behaviour). | 1189 * undefined behaviour). |
| 1179 * | 1190 * |
| 1180 * [button] should be 0 for left, 1 for middle, or 2 for right. | 1191 * [button] should be 0 for left, 1 for middle, or 2 for right. |
| 1181 */ | 1192 */ |
| 1182 Future clickMouse([button = 0]) => _post('click', { 'button' : button }); | 1193 Future clickMouse([button = 0]) => _post('click', { 'button' : button }); |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1459 * | 1470 * |
| 1460 * 'timestamp' (int) - The timestamp of the entry. | 1471 * 'timestamp' (int) - The timestamp of the entry. |
| 1461 * 'level' (String) - The log level of the entry, for example, "INFO". | 1472 * 'level' (String) - The log level of the entry, for example, "INFO". |
| 1462 * 'message' (String) - The log message. | 1473 * 'message' (String) - The log message. |
| 1463 * | 1474 * |
| 1464 * This works with Firefox but Chrome returns a 500 response due to a | 1475 * This works with Firefox but Chrome returns a 500 response due to a |
| 1465 * bad cast. | 1476 * bad cast. |
| 1466 */ | 1477 */ |
| 1467 Future<List<Map>> getLogs(String type) => _post('log', { 'type': type }); | 1478 Future<List<Map>> getLogs(String type) => _post('log', { 'type': type }); |
| 1468 } | 1479 } |
| OLD | NEW |