| 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.FileDetector)} */ |
| 56 | exports.FileDetector = base.require('webdriver.FileDetector'); |
| 57 | |
| 58 | |
| 59 | /** @type {function(new: webdriver.Serializable)} */ |
| 60 | exports.Serializable = base.require('webdriver.Serializable'); |
| 61 | |
| 62 | |
| 63 | /** @type {function(new: webdriver.Session)} */ |
| 64 | exports.Session = base.require('webdriver.Session'); |
| 65 | |
| 66 | |
| 67 | /** @type {function(new: webdriver.WebDriver)} */ |
| 68 | exports.WebDriver = base.require('webdriver.WebDriver'); |
| 69 | |
| 70 | |
| 71 | /** @type {function(new: webdriver.WebElement)} */ |
| 72 | exports.WebElement = base.require('webdriver.WebElement'); |
| 73 | |
| 74 | |
| 75 | /** @type {function(new: webdriver.WebElementPromise)} */ |
| 76 | exports.WebElementPromise = base.require('webdriver.WebElementPromise'); |
| 77 | |
| 78 | |
| 79 | // Export the remainder of our API through getters to keep things cleaner |
| 80 | // when this module is used in a REPL environment. |
| 81 | |
| 82 | |
| 83 | /** @type {webdriver.Browser.} */ |
| 84 | (exports.__defineGetter__('Browser', function() { |
| 85 | return base.require('webdriver.Browser'); |
| 86 | })); |
| 87 | |
| 88 | |
| 89 | /** @type {webdriver.Button.} */ |
| 90 | (exports.__defineGetter__('Button', function() { |
| 91 | return base.require('webdriver.Button'); |
| 92 | })); |
| 93 | |
| 94 | |
| 95 | /** @type {webdriver.Capability.} */ |
| 96 | (exports.__defineGetter__('Capability', function() { |
| 97 | return base.require('webdriver.Capability'); |
| 98 | })); |
| 99 | |
| 100 | |
| 101 | /** @type {webdriver.CommandName.} */ |
| 102 | (exports.__defineGetter__('CommandName', function() { |
| 103 | return base.require('webdriver.CommandName'); |
| 104 | })); |
| 105 | |
| 106 | |
| 107 | /** @type {webdriver.Key.} */ |
| 108 | (exports.__defineGetter__('Key', function() { |
| 109 | return base.require('webdriver.Key'); |
| 110 | })); |
| 111 | |
| 112 | |
| 113 | /** @type {error.} */ |
| 114 | (exports.__defineGetter__('error', function() { |
| 115 | return error; |
| 116 | })); |
| 117 | |
| 118 | |
| 119 | /** @type {error.} */ |
| 120 | (exports.__defineGetter__('error', function() { |
| 121 | return error; |
| 122 | })); |
| 123 | |
| 124 | |
| 125 | /** @type {webdriver.logging.} */ |
| 126 | (exports.__defineGetter__('logging', function() { |
| 127 | return base.exportPublicApi('webdriver.logging'); |
| 128 | })); |
| 129 | |
| 130 | |
| 131 | /** @type {webdriver.promise.} */ |
| 132 | (exports.__defineGetter__('promise', function() { |
| 133 | return base.exportPublicApi('webdriver.promise'); |
| 134 | })); |
| 135 | |
| 136 | |
| 137 | /** @type {webdriver.stacktrace.} */ |
| 138 | (exports.__defineGetter__('stacktrace', function() { |
| 139 | return base.exportPublicApi('webdriver.stacktrace'); |
| 140 | })); |
| 141 | |
| 142 | |
| 143 | /** @type {webdriver.until.} */ |
| 144 | (exports.__defineGetter__('until', function() { |
| 145 | return base.exportPublicApi('webdriver.until'); |
| 146 | })); |