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