1 | // Copyright 2012 Selenium committers |
2 | // Copyright 2012 Software Freedom Conservancy |
3 | // |
4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
5 | // you may not use this file except in compliance with the License. |
6 | // You may obtain a copy of the License at |
7 | // |
8 | // http://www.apache.org/licenses/LICENSE-2.0 |
9 | // |
10 | // Unless required by applicable law or agreed to in writing, software |
11 | // distributed under the License is distributed on an "AS IS" BASIS, |
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | // See the License for the specific language governing permissions and |
14 | // limitations under the License. |
15 | |
16 | /** |
17 | * @fileoverview The main user facing module. Exports WebDriver's primary |
18 | * public API and provides convenience assessors to certain sub-modules. |
19 | */ |
20 | |
21 | var base = require('./_base'); |
22 | var builder = require('./builder'); |
23 | var error = require('./error'); |
24 | |
25 | |
26 | // NOTE: the remainder of this file is nasty and verbose, but the annotations |
27 | // are necessary to guide the Closure Compiler's type analysis. Without them, |
28 | // we would not be able to extract any meaningful API documentation. |
29 | |
30 | |
31 | /** @type {function(new: webdriver.ActionSequence)} */ |
32 | exports.ActionSequence = base.require('webdriver.ActionSequence'); |
33 | |
34 | |
35 | /** @type {function(new: builder.Builder)} */ |
36 | exports.Builder = builder.Builder; |
37 | |
38 | |
39 | /** @type {webdriver.By.} */ |
40 | exports.By = base.require('webdriver.By'); |
41 | |
42 | |
43 | /** @type {function(new: webdriver.Capabilities)} */ |
44 | exports.Capabilities = base.require('webdriver.Capabilities'); |
45 | |
46 | |
47 | /** @type {function(new: webdriver.Command)} */ |
48 | exports.Command = base.require('webdriver.Command'); |
49 | |
50 | |
51 | /** @type {function(new: webdriver.EventEmitter)} */ |
52 | exports.EventEmitter = base.require('webdriver.EventEmitter'); |
53 | |
54 | |
55 | /** @type {function(new: webdriver.Session)} */ |
56 | exports.Session = base.require('webdriver.Session'); |
57 | |
58 | |
59 | /** @type {function(new: webdriver.WebDriver)} */ |
60 | exports.WebDriver = base.require('webdriver.WebDriver'); |
61 | |
62 | |
63 | /** @type {function(new: webdriver.WebElement)} */ |
64 | exports.WebElement = base.require('webdriver.WebElement'); |
65 | |
66 | |
67 | // Export the remainder of our API through getters to keep things cleaner |
68 | // when this module is used in a REPL environment. |
69 | |
70 | |
71 | /** @type {webdriver.Browser.} */ |
72 | (exports.__defineGetter__('Browser', function() { |
73 | return base.require('webdriver.Browser'); |
74 | })); |
75 | |
76 | |
77 | /** @type {webdriver.Button.} */ |
78 | (exports.__defineGetter__('Button', function() { |
79 | return base.require('webdriver.Button'); |
80 | })); |
81 | |
82 | |
83 | /** @type {webdriver.Capability.} */ |
84 | (exports.__defineGetter__('Capability', function() { |
85 | return base.require('webdriver.Capability'); |
86 | })); |
87 | |
88 | |
89 | /** @type {webdriver.CommandName.} */ |
90 | (exports.__defineGetter__('CommandName', function() { |
91 | return base.require('webdriver.CommandName'); |
92 | })); |
93 | |
94 | |
95 | /** @type {webdriver.Key.} */ |
96 | (exports.__defineGetter__('Key', function() { |
97 | return base.require('webdriver.Key'); |
98 | })); |
99 | |
100 | |
101 | /** @type {error.} */ |
102 | (exports.__defineGetter__('error', function() { |
103 | return error; |
104 | })); |
105 | |
106 | |
107 | /** @type {error.} */ |
108 | (exports.__defineGetter__('error', function() { |
109 | return error; |
110 | })); |
111 | |
112 | |
113 | /** @type {webdriver.logging.} */ |
114 | (exports.__defineGetter__('logging', function() { |
115 | return base.exportPublicApi('webdriver.logging'); |
116 | })); |
117 | |
118 | |
119 | /** @type {webdriver.promise.} */ |
120 | (exports.__defineGetter__('promise', function() { |
121 | return base.exportPublicApi('webdriver.promise'); |
122 | })); |
123 | |
124 | |
125 | /** @type {webdriver.stacktrace.} */ |
126 | (exports.__defineGetter__('stacktrace', function() { |
127 | return base.exportPublicApi('webdriver.stacktrace'); |
128 | })); |