OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 import 'dart:uri'; | 10 import 'dart:uri'; |
11 | 11 |
12 part 'src/base64decoder.dart'; | 12 part 'src/base64decoder.dart'; |
13 | 13 |
14 /** | 14 /** |
15 * WebDriver bindings for Dart. | 15 * WebDriver bindings for Dart. |
16 * | 16 * |
| 17 * ## Installing ## |
| 18 * |
| 19 * Use [pub][] to install this package. Add the following to your `pubspec.yaml` |
| 20 * file. |
| 21 * |
| 22 * dependencies: |
| 23 * webdriver: any |
| 24 * |
| 25 * And then run `pub install`. |
| 26 * |
| 27 * ## Using ## |
| 28 * |
17 * These bindings are based on the WebDriver JSON wire protocol spec | 29 * These bindings are based on the WebDriver JSON wire protocol spec |
18 * (http://code.google.com/p/selenium/wiki/JsonWireProtocol). Not | 30 * (http://code.google.com/p/selenium/wiki/JsonWireProtocol). Not |
19 * all of these commands are implemented yet by WebDriver itself. | 31 * all of these commands are implemented yet by WebDriver itself. |
20 * Nontheless this is a complete implementation of the spec as the | 32 * Nontheless this is a complete implementation of the spec as the |
21 * unsupported commands may be supported in the future. Currently, | 33 * unsupported commands may be supported in the future. Currently, |
22 * there are known issues with local and session storage, script | 34 * there are known issues with local and session storage, script |
23 * execution, and log access. | 35 * execution, and log access. |
24 * | 36 * |
25 * To use these bindings, the Selenium standalone server must be running. | 37 * To use these bindings, the Selenium standalone server must be running. |
26 * You can download it at http://code.google.com/p/selenium/downloads/list. | 38 * You can download it at http://code.google.com/p/selenium/downloads/list. |
(...skipping 16 matching lines...) Expand all Loading... |
43 * id = element['ELEMENT']; | 55 * id = element['ELEMENT']; |
44 * return session.sendKeyStrokesToElement(id, | 56 * return session.sendKeyStrokesToElement(id, |
45 * [ 'j', 'o', 'e', ' ', 'u', 's', 'e', 'r' ]); | 57 * [ 'j', 'o', 'e', ' ', 'u', 's', 'e', 'r' ]); |
46 * }).then((_) { | 58 * }).then((_) { |
47 * return session.submit(id); | 59 * return session.submit(id); |
48 * }).then((_) { | 60 * }).then((_) { |
49 * return session.close(); | 61 * return session.close(); |
50 * }).then((_) { | 62 * }).then((_) { |
51 * session = null; | 63 * session = null; |
52 * }); | 64 * }); |
| 65 * |
| 66 * [pub]: http://pub.dartlang.org |
53 */ | 67 */ |
54 | 68 |
55 void writeStringToFile(String fileName, String contents) { | 69 void writeStringToFile(String fileName, String contents) { |
56 new File(fileName).writeAsStringSync(contents); | 70 new File(fileName).writeAsStringSync(contents); |
57 } | 71 } |
58 | 72 |
59 void writeBytesToFile(String fileName, List<int> contents) { | 73 void writeBytesToFile(String fileName, List<int> contents) { |
60 new File(fileName).writeAsBytesSync(contents); | 74 new File(fileName).writeAsBytesSync(contents); |
61 } | 75 } |
62 | 76 |
(...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1442 * | 1456 * |
1443 * 'timestamp' (int) - The timestamp of the entry. | 1457 * 'timestamp' (int) - The timestamp of the entry. |
1444 * 'level' (String) - The log level of the entry, for example, "INFO". | 1458 * 'level' (String) - The log level of the entry, for example, "INFO". |
1445 * 'message' (String) - The log message. | 1459 * 'message' (String) - The log message. |
1446 * | 1460 * |
1447 * This works with Firefox but Chrome returns a 500 response due to a | 1461 * This works with Firefox but Chrome returns a 500 response due to a |
1448 * bad cast. | 1462 * bad cast. |
1449 */ | 1463 */ |
1450 Future<List<Map>> getLogs(String type) => _post('log', { 'type': type }); | 1464 Future<List<Map>> getLogs(String type) => _post('log', { 'type': type }); |
1451 } | 1465 } |
OLD | NEW |