index.js

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
21var base = require('./_base');
22var builder = require('./builder');
23var 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)} */
32exports.ActionSequence = base.require('webdriver.ActionSequence');
33
34
35/** @type {function(new: builder.Builder)} */
36exports.Builder = builder.Builder;
37
38
39/** @type {webdriver.By.} */
40exports.By = base.require('webdriver.By');
41
42
43/** @type {function(new: webdriver.Capabilities)} */
44exports.Capabilities = base.require('webdriver.Capabilities');
45
46
47/** @type {function(new: webdriver.Command)} */
48exports.Command = base.require('webdriver.Command');
49
50
51/** @type {function(new: webdriver.EventEmitter)} */
52exports.EventEmitter = base.require('webdriver.EventEmitter');
53
54
55/** @type {function(new: webdriver.Session)} */
56exports.Session = base.require('webdriver.Session');
57
58
59/** @type {function(new: webdriver.WebDriver)} */
60exports.WebDriver = base.require('webdriver.WebDriver');
61
62
63/** @type {function(new: webdriver.WebElement)} */
64exports.WebElement = base.require('webdriver.WebElement');
65
66
67/** @type {function(new: webdriver.WebElementPromise)} */
68exports.WebElementPromise = base.require('webdriver.WebElementPromise');
69
70
71// Export the remainder of our API through getters to keep things cleaner
72// when this module is used in a REPL environment.
73
74
75/** @type {webdriver.Browser.} */
76(exports.__defineGetter__('Browser', function() {
77 return base.require('webdriver.Browser');
78}));
79
80
81/** @type {webdriver.Button.} */
82(exports.__defineGetter__('Button', function() {
83 return base.require('webdriver.Button');
84}));
85
86
87/** @type {webdriver.Capability.} */
88(exports.__defineGetter__('Capability', function() {
89 return base.require('webdriver.Capability');
90}));
91
92
93/** @type {webdriver.CommandName.} */
94(exports.__defineGetter__('CommandName', function() {
95 return base.require('webdriver.CommandName');
96}));
97
98
99/** @type {webdriver.Key.} */
100(exports.__defineGetter__('Key', function() {
101 return base.require('webdriver.Key');
102}));
103
104
105/** @type {error.} */
106(exports.__defineGetter__('error', function() {
107 return error;
108}));
109
110
111/** @type {error.} */
112(exports.__defineGetter__('error', function() {
113 return error;
114}));
115
116
117/** @type {webdriver.logging.} */
118(exports.__defineGetter__('logging', function() {
119 return base.exportPublicApi('webdriver.logging');
120}));
121
122
123/** @type {webdriver.promise.} */
124(exports.__defineGetter__('promise', function() {
125 return base.exportPublicApi('webdriver.promise');
126}));
127
128
129/** @type {webdriver.stacktrace.} */
130(exports.__defineGetter__('stacktrace', function() {
131 return base.exportPublicApi('webdriver.stacktrace');
132}));