# index.js

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