selenium-webdriver 3.0.0-beta-1 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGES.md +109 -0
- package/LICENSE +1 -1
- package/README.md +7 -6
- package/chrome.js +31 -128
- package/edge.js +13 -91
- package/example/chrome_android.js +18 -13
- package/example/chrome_mobile_emulation.js +19 -15
- package/example/google_search.js +11 -11
- package/example/google_search_generator.js +23 -18
- package/example/google_search_test.js +31 -17
- package/example/logging.js +9 -17
- package/example/parallel_flows.js +3 -0
- package/firefox/binary.js +17 -0
- package/firefox/index.js +198 -101
- package/firefox/profile.js +24 -3
- package/http/util.js +95 -59
- package/ie.js +6 -10
- package/index.js +636 -2
- package/lib/actions.js +18 -10
- package/lib/atoms/getAttribute.js +11 -0
- package/lib/atoms/isDisplayed.js +106 -0
- package/lib/firefox/amd64/libnoblur64.so +0 -0
- package/lib/firefox/i386/libnoblur.so +0 -0
- package/lib/firefox/webdriver.xpi +0 -0
- package/lib/http.js +159 -46
- package/lib/logging.js +7 -1
- package/lib/promise.js +602 -358
- package/lib/proxy.js +28 -0
- package/lib/session.js +1 -1
- package/lib/test/build.js +26 -28
- package/lib/test/data/formPage.html +1 -0
- package/lib/test/fileserver.js +12 -10
- package/lib/test/httpserver.js +4 -6
- package/lib/test/index.js +18 -11
- package/lib/test/promise.js +79 -0
- package/lib/webdriver.js +587 -479
- package/opera.js +12 -88
- package/package.json +13 -14
- package/phantomjs.js +7 -14
- package/remote/index.js +201 -30
- package/safari.js +62 -416
- package/test/actions_test.js +9 -11
- package/test/chrome/options_test.js +8 -8
- package/test/chrome/service_test.js +2 -2
- package/test/cookie_test.js +57 -57
- package/test/element_finding_test.js +201 -185
- package/test/execute_script_test.js +108 -111
- package/test/fingerprint_test.js +16 -11
- package/test/firefox/firefox_test.js +75 -49
- package/test/firefox/profile_test.js +1 -3
- package/test/http/util_test.js +21 -27
- package/test/io_test.js +2 -5
- package/test/lib/http_test.js +8 -6
- package/test/lib/promise_aplus_test.js +48 -44
- package/test/lib/promise_error_test.js +687 -611
- package/test/lib/promise_flow_test.js +1810 -1806
- package/test/lib/promise_generator_test.js +227 -225
- package/test/lib/promise_test.js +864 -835
- package/test/lib/until_test.js +1 -1
- package/test/lib/webdriver_test.js +520 -424
- package/test/logging_test.js +43 -45
- package/test/net/portprober_test.js +23 -24
- package/test/page_loading_test.js +84 -78
- package/test/phantomjs/execute_phantomjs_test.js +11 -25
- package/test/proxy_test.js +23 -23
- package/test/remote_test.js +22 -22
- package/test/safari_test.js +108 -0
- package/test/session_test.js +11 -10
- package/test/stale_element_test.js +18 -16
- package/test/tag_name_test.js +7 -5
- package/test/testing/assert_test.js +2 -3
- package/test/testing/index_test.js +163 -117
- package/test/upload_test.js +13 -13
- package/test/window_test.js +94 -70
- package/testing/index.js +176 -37
- package/builder.js +0 -553
- package/lib/safari/client.js +0 -56
package/builder.js
DELETED
|
@@ -1,553 +0,0 @@
|
|
|
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
|
-
'use strict';
|
|
19
|
-
|
|
20
|
-
const chrome = require('./chrome');
|
|
21
|
-
const edge = require('./edge');
|
|
22
|
-
const firefox = require('./firefox');
|
|
23
|
-
const _http = require('./http');
|
|
24
|
-
const ie = require('./ie');
|
|
25
|
-
const capabilities = require('./lib/capabilities');
|
|
26
|
-
const webdriver = require('./lib/webdriver');
|
|
27
|
-
const promise = require('./lib/promise');
|
|
28
|
-
const opera = require('./opera');
|
|
29
|
-
const phantomjs = require('./phantomjs');
|
|
30
|
-
const remote = require('./remote');
|
|
31
|
-
const safari = require('./safari');
|
|
32
|
-
|
|
33
|
-
const Browser = capabilities.Browser;
|
|
34
|
-
const Capabilities = capabilities.Capabilities;
|
|
35
|
-
const Capability = capabilities.Capability;
|
|
36
|
-
const WebDriver = webdriver.WebDriver;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
var seleniumServer;
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Starts an instance of the Selenium server if not yet running.
|
|
44
|
-
* @param {string} jar Path to the server jar to use.
|
|
45
|
-
* @return {!Promise<string>} A promise for the server's
|
|
46
|
-
* addrss once started.
|
|
47
|
-
*/
|
|
48
|
-
function startSeleniumServer(jar) {
|
|
49
|
-
if (!seleniumServer) {
|
|
50
|
-
seleniumServer = new remote.SeleniumServer(jar);
|
|
51
|
-
}
|
|
52
|
-
return seleniumServer.start();
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Creates new {@link webdriver.WebDriver WebDriver} instances. The environment
|
|
58
|
-
* variables listed below may be used to override a builder's configuration,
|
|
59
|
-
* allowing quick runtime changes.
|
|
60
|
-
*
|
|
61
|
-
* - {@code SELENIUM_BROWSER}: defines the target browser in the form
|
|
62
|
-
* {@code browser[:version][:platform]}.
|
|
63
|
-
*
|
|
64
|
-
* - {@code SELENIUM_REMOTE_URL}: defines the remote URL for all builder
|
|
65
|
-
* instances. This environment variable should be set to a fully qualified
|
|
66
|
-
* URL for a WebDriver server (e.g. http://localhost:4444/wd/hub). This
|
|
67
|
-
* option always takes precedence over {@code SELENIUM_SERVER_JAR}.
|
|
68
|
-
*
|
|
69
|
-
* - {@code SELENIUM_SERVER_JAR}: defines the path to the
|
|
70
|
-
* <a href="http://selenium-release.storage.googleapis.com/index.html">
|
|
71
|
-
* standalone Selenium server</a> jar to use. The server will be started the
|
|
72
|
-
* first time a WebDriver instance and be killed when the process exits.
|
|
73
|
-
*
|
|
74
|
-
* Suppose you had mytest.js that created WebDriver with
|
|
75
|
-
*
|
|
76
|
-
* var driver = new webdriver.Builder()
|
|
77
|
-
* .forBrowser('chrome')
|
|
78
|
-
* .build();
|
|
79
|
-
*
|
|
80
|
-
* This test could be made to use Firefox on the local machine by running with
|
|
81
|
-
* `SELENIUM_BROWSER=firefox node mytest.js`. Rather than change the code to
|
|
82
|
-
* target Google Chrome on a remote machine, you can simply set the
|
|
83
|
-
* `SELENIUM_BROWSER` and `SELENIUM_REMOTE_URL` environment variables:
|
|
84
|
-
*
|
|
85
|
-
* SELENIUM_BROWSER=chrome:36:LINUX \
|
|
86
|
-
* SELENIUM_REMOTE_URL=http://www.example.com:4444/wd/hub \
|
|
87
|
-
* node mytest.js
|
|
88
|
-
*
|
|
89
|
-
* You could also use a local copy of the standalone Selenium server:
|
|
90
|
-
*
|
|
91
|
-
* SELENIUM_BROWSER=chrome:36:LINUX \
|
|
92
|
-
* SELENIUM_SERVER_JAR=/path/to/selenium-server-standalone.jar \
|
|
93
|
-
* node mytest.js
|
|
94
|
-
*/
|
|
95
|
-
class Builder {
|
|
96
|
-
constructor() {
|
|
97
|
-
/** @private {promise.ControlFlow} */
|
|
98
|
-
this.flow_ = null;
|
|
99
|
-
|
|
100
|
-
/** @private {string} */
|
|
101
|
-
this.url_ = '';
|
|
102
|
-
|
|
103
|
-
/** @private {?string} */
|
|
104
|
-
this.proxy_ = null;
|
|
105
|
-
|
|
106
|
-
/** @private {!Capabilities} */
|
|
107
|
-
this.capabilities_ = new Capabilities();
|
|
108
|
-
|
|
109
|
-
/** @private {chrome.Options} */
|
|
110
|
-
this.chromeOptions_ = null;
|
|
111
|
-
|
|
112
|
-
/** @private {firefox.Options} */
|
|
113
|
-
this.firefoxOptions_ = null;
|
|
114
|
-
|
|
115
|
-
/** @private {opera.Options} */
|
|
116
|
-
this.operaOptions_ = null;
|
|
117
|
-
|
|
118
|
-
/** @private {ie.Options} */
|
|
119
|
-
this.ieOptions_ = null;
|
|
120
|
-
|
|
121
|
-
/** @private {safari.Options} */
|
|
122
|
-
this.safariOptions_ = null;
|
|
123
|
-
|
|
124
|
-
/** @private {edge.Options} */
|
|
125
|
-
this.edgeOptions_ = null;
|
|
126
|
-
|
|
127
|
-
/** @private {boolean} */
|
|
128
|
-
this.ignoreEnv_ = false;
|
|
129
|
-
|
|
130
|
-
/** @private {http.Agent} */
|
|
131
|
-
this.agent_ = null;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Configures this builder to ignore any environment variable overrides and to
|
|
136
|
-
* only use the configuration specified through this instance's API.
|
|
137
|
-
*
|
|
138
|
-
* @return {!Builder} A self reference.
|
|
139
|
-
*/
|
|
140
|
-
disableEnvironmentOverrides() {
|
|
141
|
-
this.ignoreEnv_ = true;
|
|
142
|
-
return this;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Sets the URL of a remote WebDriver server to use. Once a remote URL has
|
|
147
|
-
* been specified, the builder direct all new clients to that server. If this
|
|
148
|
-
* method is never called, the Builder will attempt to create all clients
|
|
149
|
-
* locally.
|
|
150
|
-
*
|
|
151
|
-
* As an alternative to this method, you may also set the
|
|
152
|
-
* `SELENIUM_REMOTE_URL` environment variable.
|
|
153
|
-
*
|
|
154
|
-
* @param {string} url The URL of a remote server to use.
|
|
155
|
-
* @return {!Builder} A self reference.
|
|
156
|
-
*/
|
|
157
|
-
usingServer(url) {
|
|
158
|
-
this.url_ = url;
|
|
159
|
-
return this;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* @return {string} The URL of the WebDriver server this instance is
|
|
164
|
-
* configured to use.
|
|
165
|
-
*/
|
|
166
|
-
getServerUrl() {
|
|
167
|
-
return this.url_;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Sets the URL of the proxy to use for the WebDriver's HTTP connections.
|
|
172
|
-
* If this method is never called, the Builder will create a connection
|
|
173
|
-
* without a proxy.
|
|
174
|
-
*
|
|
175
|
-
* @param {string} proxy The URL of a proxy to use.
|
|
176
|
-
* @return {!Builder} A self reference.
|
|
177
|
-
*/
|
|
178
|
-
usingWebDriverProxy(proxy) {
|
|
179
|
-
this.proxy_ = proxy;
|
|
180
|
-
return this;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* @return {?string} The URL of the proxy server to use for the WebDriver's
|
|
185
|
-
* HTTP connections, or `null` if not set.
|
|
186
|
-
*/
|
|
187
|
-
getWebDriverProxy() {
|
|
188
|
-
return this.proxy_;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* Sets the http agent to use for each request.
|
|
193
|
-
* If this method is not called, the Builder will use http.globalAgent by default.
|
|
194
|
-
*
|
|
195
|
-
* @param {http.Agent} agent The agent to use for each request.
|
|
196
|
-
* @return {!Builder} A self reference.
|
|
197
|
-
*/
|
|
198
|
-
usingHttpAgent(agent) {
|
|
199
|
-
this.agent_ = agent;
|
|
200
|
-
return this;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* @return {http.Agent} The http agent used for each request
|
|
205
|
-
*/
|
|
206
|
-
getHttpAgent() {
|
|
207
|
-
return this.agent_;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* Sets the desired capabilities when requesting a new session. This will
|
|
212
|
-
* overwrite any previously set capabilities.
|
|
213
|
-
* @param {!(Object|Capabilities)} capabilities The desired capabilities for
|
|
214
|
-
* a new session.
|
|
215
|
-
* @return {!Builder} A self reference.
|
|
216
|
-
*/
|
|
217
|
-
withCapabilities(capabilities) {
|
|
218
|
-
this.capabilities_ = new Capabilities(capabilities);
|
|
219
|
-
return this;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* Returns the base set of capabilities this instance is currently configured
|
|
224
|
-
* to use.
|
|
225
|
-
* @return {!Capabilities} The current capabilities for this builder.
|
|
226
|
-
*/
|
|
227
|
-
getCapabilities() {
|
|
228
|
-
return this.capabilities_;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* Configures the target browser for clients created by this instance.
|
|
233
|
-
* Any calls to {@link #withCapabilities} after this function will
|
|
234
|
-
* overwrite these settings.
|
|
235
|
-
*
|
|
236
|
-
* You may also define the target browser using the {@code SELENIUM_BROWSER}
|
|
237
|
-
* environment variable. If set, this environment variable should be of the
|
|
238
|
-
* form `browser[:[version][:platform]]`.
|
|
239
|
-
*
|
|
240
|
-
* @param {(string|Browser)} name The name of the target browser;
|
|
241
|
-
* common defaults are available on the {@link webdriver.Browser} enum.
|
|
242
|
-
* @param {string=} opt_version A desired version; may be omitted if any
|
|
243
|
-
* version should be used.
|
|
244
|
-
* @param {string=} opt_platform The desired platform; may be omitted if any
|
|
245
|
-
* version may be used.
|
|
246
|
-
* @return {!Builder} A self reference.
|
|
247
|
-
*/
|
|
248
|
-
forBrowser(name, opt_version, opt_platform) {
|
|
249
|
-
this.capabilities_.set(Capability.BROWSER_NAME, name);
|
|
250
|
-
this.capabilities_.set(Capability.VERSION, opt_version || null);
|
|
251
|
-
this.capabilities_.set(Capability.PLATFORM, opt_platform || null);
|
|
252
|
-
return this;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* Sets the proxy configuration for the target browser.
|
|
257
|
-
* Any calls to {@link #withCapabilities} after this function will
|
|
258
|
-
* overwrite these settings.
|
|
259
|
-
*
|
|
260
|
-
* @param {!capabilities.ProxyConfig} config The configuration to use.
|
|
261
|
-
* @return {!Builder} A self reference.
|
|
262
|
-
*/
|
|
263
|
-
setProxy(config) {
|
|
264
|
-
this.capabilities_.setProxy(config);
|
|
265
|
-
return this;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* Sets the logging preferences for the created session. Preferences may be
|
|
270
|
-
* changed by repeated calls, or by calling {@link #withCapabilities}.
|
|
271
|
-
* @param {!(./lib/logging.Preferences|Object<string, string>)} prefs The
|
|
272
|
-
* desired logging preferences.
|
|
273
|
-
* @return {!Builder} A self reference.
|
|
274
|
-
*/
|
|
275
|
-
setLoggingPrefs(prefs) {
|
|
276
|
-
this.capabilities_.setLoggingPrefs(prefs);
|
|
277
|
-
return this;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
/**
|
|
281
|
-
* Sets whether native events should be used.
|
|
282
|
-
* @param {boolean} enabled Whether to enable native events.
|
|
283
|
-
* @return {!Builder} A self reference.
|
|
284
|
-
*/
|
|
285
|
-
setEnableNativeEvents(enabled) {
|
|
286
|
-
this.capabilities_.setEnableNativeEvents(enabled);
|
|
287
|
-
return this;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
/**
|
|
291
|
-
* Sets how elements should be scrolled into view for interaction.
|
|
292
|
-
* @param {number} behavior The desired scroll behavior: either 0 to align
|
|
293
|
-
* with the top of the viewport or 1 to align with the bottom.
|
|
294
|
-
* @return {!Builder} A self reference.
|
|
295
|
-
*/
|
|
296
|
-
setScrollBehavior(behavior) {
|
|
297
|
-
this.capabilities_.setScrollBehavior(behavior);
|
|
298
|
-
return this;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
/**
|
|
302
|
-
* Sets the default action to take with an unexpected alert before returning
|
|
303
|
-
* an error.
|
|
304
|
-
* @param {string} behavior The desired behavior; should be "accept",
|
|
305
|
-
* "dismiss", or "ignore". Defaults to "dismiss".
|
|
306
|
-
* @return {!Builder} A self reference.
|
|
307
|
-
*/
|
|
308
|
-
setAlertBehavior(behavior) {
|
|
309
|
-
this.capabilities_.setAlertBehavior(behavior);
|
|
310
|
-
return this;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
/**
|
|
314
|
-
* Sets Chrome specific {@linkplain chrome.Options options} for drivers
|
|
315
|
-
* created by this builder. Any logging or proxy settings defined on the given
|
|
316
|
-
* options will take precedence over those set through
|
|
317
|
-
* {@link #setLoggingPrefs} and {@link #setProxy}, respectively.
|
|
318
|
-
*
|
|
319
|
-
* @param {!chrome.Options} options The ChromeDriver options to use.
|
|
320
|
-
* @return {!Builder} A self reference.
|
|
321
|
-
*/
|
|
322
|
-
setChromeOptions(options) {
|
|
323
|
-
this.chromeOptions_ = options;
|
|
324
|
-
return this;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
/**
|
|
328
|
-
* Sets Firefox specific {@linkplain firefox.Options options} for drivers
|
|
329
|
-
* created by this builder. Any logging or proxy settings defined on the given
|
|
330
|
-
* options will take precedence over those set through
|
|
331
|
-
* {@link #setLoggingPrefs} and {@link #setProxy}, respectively.
|
|
332
|
-
*
|
|
333
|
-
* @param {!firefox.Options} options The FirefoxDriver options to use.
|
|
334
|
-
* @return {!Builder} A self reference.
|
|
335
|
-
*/
|
|
336
|
-
setFirefoxOptions(options) {
|
|
337
|
-
this.firefoxOptions_ = options;
|
|
338
|
-
return this;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
/**
|
|
342
|
-
* @return {firefox.Options} the Firefox specific options currently configured
|
|
343
|
-
* for this instance.
|
|
344
|
-
*/
|
|
345
|
-
getFirefoxOptions() {
|
|
346
|
-
return this.firefoxOptions_;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
/**
|
|
350
|
-
* Sets Opera specific {@linkplain opera.Options options} for drivers created
|
|
351
|
-
* by this builder. Any logging or proxy settings defined on the given options
|
|
352
|
-
* will take precedence over those set through {@link #setLoggingPrefs} and
|
|
353
|
-
* {@link #setProxy}, respectively.
|
|
354
|
-
*
|
|
355
|
-
* @param {!opera.Options} options The OperaDriver options to use.
|
|
356
|
-
* @return {!Builder} A self reference.
|
|
357
|
-
*/
|
|
358
|
-
setOperaOptions(options) {
|
|
359
|
-
this.operaOptions_ = options;
|
|
360
|
-
return this;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
/**
|
|
364
|
-
* Set Internet Explorer specific {@linkplain ie.Options options} for drivers
|
|
365
|
-
* created by this builder. Any proxy settings defined on the given options
|
|
366
|
-
* will take precedence over those set through {@link #setProxy}.
|
|
367
|
-
*
|
|
368
|
-
* @param {!ie.Options} options The IEDriver options to use.
|
|
369
|
-
* @return {!Builder} A self reference.
|
|
370
|
-
*/
|
|
371
|
-
setIeOptions(options) {
|
|
372
|
-
this.ieOptions_ = options;
|
|
373
|
-
return this;
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
/**
|
|
377
|
-
* Set {@linkplain edge.Options options} specific to Microsoft's Edge browser
|
|
378
|
-
* for drivers created by this builder. Any proxy settings defined on the
|
|
379
|
-
* given options will take precedence over those set through
|
|
380
|
-
* {@link #setProxy}.
|
|
381
|
-
*
|
|
382
|
-
* @param {!edge.Options} options The MicrosoftEdgeDriver options to use.
|
|
383
|
-
* @return {!Builder} A self reference.
|
|
384
|
-
*/
|
|
385
|
-
setEdgeOptions(options) {
|
|
386
|
-
this.edgeOptions_ = options;
|
|
387
|
-
return this;
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
/**
|
|
391
|
-
* Sets Safari specific {@linkplain safari.Options options} for drivers
|
|
392
|
-
* created by this builder. Any logging settings defined on the given options
|
|
393
|
-
* will take precedence over those set through {@link #setLoggingPrefs}.
|
|
394
|
-
*
|
|
395
|
-
* @param {!safari.Options} options The Safari options to use.
|
|
396
|
-
* @return {!Builder} A self reference.
|
|
397
|
-
*/
|
|
398
|
-
setSafariOptions(options) {
|
|
399
|
-
this.safariOptions_ = options;
|
|
400
|
-
return this;
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
/**
|
|
404
|
-
* Sets the control flow that created drivers should execute actions in. If
|
|
405
|
-
* the flow is never set, or is set to {@code null}, it will use the active
|
|
406
|
-
* flow at the time {@link #build()} is called.
|
|
407
|
-
* @param {promise.ControlFlow} flow The control flow to use, or
|
|
408
|
-
* {@code null} to
|
|
409
|
-
* @return {!Builder} A self reference.
|
|
410
|
-
*/
|
|
411
|
-
setControlFlow(flow) {
|
|
412
|
-
this.flow_ = flow;
|
|
413
|
-
return this;
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
/**
|
|
417
|
-
* Creates a new WebDriver client based on this builder's current
|
|
418
|
-
* configuration.
|
|
419
|
-
*
|
|
420
|
-
* While this method will immediately return a new WebDriver instance, any
|
|
421
|
-
* commands issued against it will be deferred until the associated browser
|
|
422
|
-
* has been fully initialized. Users may call {@link #buildAsync()} to obtain
|
|
423
|
-
* a promise that will not be fulfilled until the browser has been created
|
|
424
|
-
* (the difference is purely in style).
|
|
425
|
-
*
|
|
426
|
-
* @return {!webdriver.WebDriver} A new WebDriver instance.
|
|
427
|
-
* @throws {Error} If the current configuration is invalid.
|
|
428
|
-
* @see #buildAsync()
|
|
429
|
-
*/
|
|
430
|
-
build() {
|
|
431
|
-
// Create a copy for any changes we may need to make based on the current
|
|
432
|
-
// environment.
|
|
433
|
-
var capabilities = new Capabilities(this.capabilities_);
|
|
434
|
-
|
|
435
|
-
var browser;
|
|
436
|
-
if (!this.ignoreEnv_ && process.env.SELENIUM_BROWSER) {
|
|
437
|
-
browser = process.env.SELENIUM_BROWSER.split(/:/, 3);
|
|
438
|
-
capabilities.set(Capability.BROWSER_NAME, browser[0]);
|
|
439
|
-
capabilities.set(Capability.VERSION, browser[1] || null);
|
|
440
|
-
capabilities.set(Capability.PLATFORM, browser[2] || null);
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
browser = capabilities.get(Capability.BROWSER_NAME);
|
|
444
|
-
|
|
445
|
-
if (typeof browser !== 'string') {
|
|
446
|
-
throw TypeError(
|
|
447
|
-
`Target browser must be a string, but is <${typeof browser}>;` +
|
|
448
|
-
' did you forget to call forBrowser()?');
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
if (browser === 'ie') {
|
|
452
|
-
browser = Browser.INTERNET_EXPLORER;
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
// Apply browser specific overrides.
|
|
456
|
-
if (browser === Browser.CHROME && this.chromeOptions_) {
|
|
457
|
-
capabilities.merge(this.chromeOptions_.toCapabilities());
|
|
458
|
-
|
|
459
|
-
} else if (browser === Browser.FIREFOX && this.firefoxOptions_) {
|
|
460
|
-
capabilities.merge(this.firefoxOptions_.toCapabilities());
|
|
461
|
-
|
|
462
|
-
} else if (browser === Browser.INTERNET_EXPLORER && this.ieOptions_) {
|
|
463
|
-
capabilities.merge(this.ieOptions_.toCapabilities());
|
|
464
|
-
|
|
465
|
-
} else if (browser === Browser.OPERA && this.operaOptions_) {
|
|
466
|
-
capabilities.merge(this.operaOptions_.toCapabilities());
|
|
467
|
-
|
|
468
|
-
} else if (browser === Browser.SAFARI && this.safariOptions_) {
|
|
469
|
-
capabilities.merge(this.safariOptions_.toCapabilities());
|
|
470
|
-
|
|
471
|
-
} else if (browser === Browser.EDGE && this.edgeOptions_) {
|
|
472
|
-
capabilities.merge(this.edgeOptions_.toCapabilities());
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
// Check for a remote browser.
|
|
476
|
-
var url = this.url_;
|
|
477
|
-
if (!this.ignoreEnv_) {
|
|
478
|
-
if (process.env.SELENIUM_REMOTE_URL) {
|
|
479
|
-
url = process.env.SELENIUM_REMOTE_URL;
|
|
480
|
-
} else if (process.env.SELENIUM_SERVER_JAR) {
|
|
481
|
-
url = startSeleniumServer(process.env.SELENIUM_SERVER_JAR);
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
if (url) {
|
|
486
|
-
let client = Promise.resolve(url)
|
|
487
|
-
.then(url => new _http.HttpClient(url, this.agent_, this.proxy_));
|
|
488
|
-
let executor = new _http.Executor(client);
|
|
489
|
-
|
|
490
|
-
if (browser === Browser.CHROME) {
|
|
491
|
-
return new chrome.Driver(capabilities, null, this.flow_, executor);
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
if (browser === Browser.FIREFOX) {
|
|
495
|
-
return new firefox.Driver(capabilities, this.flow_, executor);
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
return WebDriver.createSession(executor, capabilities, this.flow_);
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
// Check for a native browser.
|
|
502
|
-
switch (browser) {
|
|
503
|
-
case Browser.CHROME:
|
|
504
|
-
return new chrome.Driver(capabilities, null, this.flow_);
|
|
505
|
-
|
|
506
|
-
case Browser.FIREFOX:
|
|
507
|
-
return new firefox.Driver(capabilities, this.flow_);
|
|
508
|
-
|
|
509
|
-
case Browser.INTERNET_EXPLORER:
|
|
510
|
-
return new ie.Driver(capabilities, this.flow_);
|
|
511
|
-
|
|
512
|
-
case Browser.EDGE:
|
|
513
|
-
return new edge.Driver(capabilities, null, this.flow_);
|
|
514
|
-
|
|
515
|
-
case Browser.OPERA:
|
|
516
|
-
return new opera.Driver(capabilities, null, this.flow_);
|
|
517
|
-
|
|
518
|
-
case Browser.PHANTOM_JS:
|
|
519
|
-
return new phantomjs.Driver(capabilities, this.flow_);
|
|
520
|
-
|
|
521
|
-
case Browser.SAFARI:
|
|
522
|
-
return new safari.Driver(capabilities, this.flow_);
|
|
523
|
-
|
|
524
|
-
default:
|
|
525
|
-
throw new Error('Do not know how to build driver: ' + browser
|
|
526
|
-
+ '; did you forget to call usingServer(url)?');
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
/**
|
|
531
|
-
* Creates a new WebDriver client based on this builder's current
|
|
532
|
-
* configuration. This method returns a promise that will not be fulfilled
|
|
533
|
-
* until the new browser session has been fully initialized.
|
|
534
|
-
*
|
|
535
|
-
* __Note:__ this method is purely a convenience wrapper around
|
|
536
|
-
* {@link #build()}.
|
|
537
|
-
*
|
|
538
|
-
* @return {!promise.Promise<!webdriver.WebDriver>} A promise that will be
|
|
539
|
-
* fulfilled with the newly created WebDriver instance once the browser
|
|
540
|
-
* has been fully initialized.
|
|
541
|
-
* @see #build()
|
|
542
|
-
*/
|
|
543
|
-
buildAsync() {
|
|
544
|
-
let driver = this.build();
|
|
545
|
-
return driver.getSession().then(() => driver);
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
// PUBLIC API
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
exports.Builder = Builder;
|
package/lib/safari/client.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
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
|
-
'use strict';var n=this;
|
|
19
|
-
function q(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";else if("function"==
|
|
20
|
-
b&&"undefined"==typeof a.call)return"object";return b}function aa(a){var b=q(a);return"array"==b||"object"==b&&"number"==typeof a.length}function r(a){return"string"==typeof a}function ba(a){var b=typeof a;return"object"==b&&null!=a||"function"==b}function ca(a,b,c){return a.call.apply(a.bind,arguments)}
|
|
21
|
-
function da(a,b,c){if(!a)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}}function ea(a,b,c){ea=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?ca:da;return ea.apply(null,arguments)}var fa=Date.now||function(){return+new Date};
|
|
22
|
-
function ga(a,b){function c(){}c.prototype=b.prototype;a.B=b.prototype;a.prototype=new c;a.prototype.constructor=a;a.w=function(a,c,g){for(var e=Array(arguments.length-2),l=2;l<arguments.length;l++)e[l-2]=arguments[l];return b.prototype[c].apply(a,e)}};function t(a){if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var b=Error().stack;b&&(this.stack=b)}a&&(this.message=String(a))}ga(t,Error);t.prototype.name="CustomError";var ia;function ja(a,b){for(var c=a.split("%s"),d="",f=Array.prototype.slice.call(arguments,1);f.length&&1<c.length;)d+=c.shift()+f.shift();return d+c.join("%s")}var ka=String.prototype.trim?function(a){return a.trim()}:function(a){return a.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")};
|
|
23
|
-
function la(a){if(!ma.test(a))return a;-1!=a.indexOf("&")&&(a=a.replace(na,"&"));-1!=a.indexOf("<")&&(a=a.replace(oa,"<"));-1!=a.indexOf(">")&&(a=a.replace(pa,">"));-1!=a.indexOf('"')&&(a=a.replace(qa,"""));-1!=a.indexOf("'")&&(a=a.replace(ra,"'"));-1!=a.indexOf("\x00")&&(a=a.replace(sa,"�"));return a}var na=/&/g,oa=/</g,pa=/>/g,qa=/"/g,ra=/'/g,sa=/\x00/g,ma=/[\x00&<>"']/;function ta(a,b){return a<b?-1:a>b?1:0};function ua(a,b){b.unshift(a);t.call(this,ja.apply(null,b));b.shift()}ga(ua,t);ua.prototype.name="AssertionError";function u(a,b){throw new ua("Failure"+(a?": "+a:""),Array.prototype.slice.call(arguments,1));};var va=Array.prototype.indexOf?function(a,b,c){return Array.prototype.indexOf.call(a,b,c)}:function(a,b,c){c=null==c?0:0>c?Math.max(0,a.length+c):c;if(r(a))return r(b)&&1==b.length?a.indexOf(b,c):-1;for(;c<a.length;c++)if(c in a&&a[c]===b)return c;return-1},wa=Array.prototype.forEach?function(a,b,c){Array.prototype.forEach.call(a,b,c)}:function(a,b,c){for(var d=a.length,f=r(a)?a.split(""):a,g=0;g<d;g++)g in f&&b.call(c,f[g],g,a)};
|
|
24
|
-
function xa(a){return Array.prototype.concat.apply(Array.prototype,arguments)}function Ba(a){var b=a.length;if(0<b){for(var c=Array(b),d=0;d<b;d++)c[d]=a[d];return c}return[]}function Ca(a,b,c){return 2>=arguments.length?Array.prototype.slice.call(a,b):Array.prototype.slice.call(a,b,c)};function Da(a,b){for(var c in a)b.call(void 0,a[c],c,a)};function v(a,b){this.b={};this.a=[];this.f=this.c=0;var c=arguments.length;if(1<c){if(c%2)throw Error("Uneven number of arguments");for(var d=0;d<c;d+=2)Ea(this,arguments[d],arguments[d+1])}else if(a){var f;if(a instanceof v)f=a.o(),d=a.l();else{var c=[],g=0;for(f in a)c[g++]=f;f=c;c=[];g=0;for(d in a)c[g++]=a[d];d=c}for(c=0;c<f.length;c++)Ea(this,f[c],d[c])}}v.prototype.l=function(){Fa(this);for(var a=[],b=0;b<this.a.length;b++)a.push(this.b[this.a[b]]);return a};
|
|
25
|
-
v.prototype.o=function(){Fa(this);return this.a.concat()};v.prototype.clear=function(){this.b={};this.f=this.c=this.a.length=0};function Fa(a){if(a.c!=a.a.length){for(var b=0,c=0;b<a.a.length;){var d=a.a[b];y(a.b,d)&&(a.a[c++]=d);b++}a.a.length=c}if(a.c!=a.a.length){for(var f={},c=b=0;b<a.a.length;)d=a.a[b],y(f,d)||(a.a[c++]=d,f[d]=1),b++;a.a.length=c}}function Ga(a,b){return y(a.b,b)?a.b[b]:void 0}function Ea(a,b,c){y(a.b,b)||(a.c++,a.a.push(b),a.f++);a.b[b]=c}
|
|
26
|
-
v.prototype.forEach=function(a,b){for(var c=this.o(),d=0;d<c.length;d++){var f=c[d];a.call(b,Ga(this,f),f,this)}};v.prototype.clone=function(){return new v(this)};function y(a,b){return Object.prototype.hasOwnProperty.call(a,b)};var Ha=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^/?#]*)@)?([^/#?]*?)(?::([0-9]+))?(?=[/#?]|$))?([^?#]+)?(?:\?([^#]*))?(?:#(.*))?$/;function Ia(a,b){if(a)for(var c=a.split("&"),d=0;d<c.length;d++){var f=c[d].indexOf("="),g=null,e=null;0<=f?(g=c[d].substring(0,f),e=c[d].substring(f+1)):g=c[d];b(g,e?decodeURIComponent(e.replace(/\+/g," ")):"")}};function z(a,b){this.f=this.u=this.c="";this.s=null;this.g=this.m="";this.a=!1;var c;a instanceof z?(this.a=void 0!==b?b:a.a,Ja(this,a.c),this.u=a.u,this.f=a.f,Ka(this,a.s),this.m=a.m,La(this,a.b.clone()),this.g=a.g):a&&(c=String(a).match(Ha))?(this.a=!!b,Ja(this,c[1]||"",!0),this.u=A(c[2]||""),this.f=A(c[3]||"",!0),Ka(this,c[4]),this.m=A(c[5]||"",!0),La(this,c[6]||"",!0),this.g=A(c[7]||"")):(this.a=!!b,this.b=new B(null,0,this.a))}
|
|
27
|
-
z.prototype.toString=function(){var a=[],b=this.c;b&&a.push(C(b,Ma,!0),":");var c=this.f;if(c||"file"==b)a.push("//"),(b=this.u)&&a.push(C(b,Ma,!0),"@"),a.push(encodeURIComponent(String(c)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),c=this.s,null!=c&&a.push(":",String(c));if(c=this.m)this.f&&"/"!=c.charAt(0)&&a.push("/"),a.push(C(c,"/"==c.charAt(0)?Na:Oa,!0));(c=this.b.toString())&&a.push("?",c);(c=this.g)&&a.push("#",C(c,Pa));return a.join("")};z.prototype.clone=function(){return new z(this)};
|
|
28
|
-
function Ja(a,b,c){a.c=c?A(b,!0):b;a.c&&(a.c=a.c.replace(/:$/,""))}function Ka(a,b){if(b){b=Number(b);if(isNaN(b)||0>b)throw Error("Bad port number "+b);a.s=b}else a.s=null}function La(a,b,c){b instanceof B?(a.b=b,Qa(a.b,a.a)):(c||(b=C(b,Ra)),a.b=new B(b,0,a.a))}function A(a,b){return a?b?decodeURI(a.replace(/%25/g,"%2525")):decodeURIComponent(a):""}function C(a,b,c){return r(a)?(a=encodeURI(a).replace(b,Sa),c&&(a=a.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),a):null}
|
|
29
|
-
function Sa(a){a=a.charCodeAt(0);return"%"+(a>>4&15).toString(16)+(a&15).toString(16)}var Ma=/[#\/\?@]/g,Oa=/[\#\?:]/g,Na=/[\#\?]/g,Ra=/[\#\?@]/g,Pa=/#/g;function B(a,b,c){this.c=this.a=null;this.b=a||null;this.f=!!c}function D(a){a.a||(a.a=new v,a.c=0,a.b&&Ia(a.b,function(b,c){var d=decodeURIComponent(b.replace(/\+/g," "));D(a);a.b=null;var d=E(a,d),f=Ga(a.a,d);f||Ea(a.a,d,f=[]);f.push(c);a.c=a.c+1}))}
|
|
30
|
-
function Ta(a,b){D(a);b=E(a,b);if(y(a.a.b,b)){a.b=null;a.c=a.c-Ga(a.a,b).length;var c=a.a;y(c.b,b)&&(delete c.b[b],c.c--,c.f++,c.a.length>2*c.c&&Fa(c))}}B.prototype.clear=function(){this.a=this.b=null;this.c=0};B.prototype.o=function(){D(this);for(var a=this.a.l(),b=this.a.o(),c=[],d=0;d<b.length;d++)for(var f=a[d],g=0;g<f.length;g++)c.push(b[d]);return c};
|
|
31
|
-
B.prototype.l=function(a){D(this);var b=[];if(r(a)){var c=a;D(this);c=E(this,c);y(this.a.b,c)&&(b=xa(b,Ga(this.a,E(this,a))))}else for(a=this.a.l(),c=0;c<a.length;c++)b=xa(b,a[c]);return b};function Ua(){var a=(new z(window.location)).b.l("url");return 0<a.length?String(a[0]):void 0}
|
|
32
|
-
B.prototype.toString=function(){if(this.b)return this.b;if(!this.a)return"";for(var a=[],b=this.a.o(),c=0;c<b.length;c++)for(var d=b[c],f=encodeURIComponent(String(d)),d=this.l(d),g=0;g<d.length;g++){var e=f;""!==d[g]&&(e+="="+encodeURIComponent(String(d[g])));a.push(e)}return this.b=a.join("&")};B.prototype.clone=function(){var a=new B;a.b=this.b;this.a&&(a.a=this.a.clone(),a.c=this.c);return a};function E(a,b){var c=String(b);a.f&&(c=c.toLowerCase());return c}
|
|
33
|
-
function Qa(a,b){b&&!a.f&&(D(a),a.b=null,a.a.forEach(function(a,b){var f=b.toLowerCase();b!=f&&(Ta(this,b),Ta(this,f),0<a.length&&(this.b=null,Ea(this.a,E(this,f),Ba(a)),this.c=this.c+a.length))},a));a.f=b};var Va={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0};function F(){this.a="";this.b=Wa}F.prototype.i=!0;F.prototype.h=function(){return this.a};F.prototype.toString=function(){return"Const{"+this.a+"}"};function Xa(a){if(a instanceof F&&a.constructor===F&&a.b===Wa)return a.a;u("expected object of type Const, got '"+a+"'");return"type_error:Const"}var Wa={};function Ya(a){var b=new F;b.a=a;return b};function G(){this.a="";this.b=Za}G.prototype.i=!0;var Za={};G.prototype.h=function(){return this.a};G.prototype.toString=function(){return"SafeStyle{"+this.a+"}"};function $a(a){var b=new G;b.a=a;return b}var ab=$a(""),bb=/^([-,."'%_!# a-zA-Z0-9]+|(?:rgb|hsl)a?\([0-9.%, ]+\))$/;function H(){this.a="";this.b=cb}H.prototype.i=!0;H.prototype.h=function(){return this.a};H.prototype.v=!0;H.prototype.j=function(){return 1};H.prototype.toString=function(){return"SafeUrl{"+this.a+"}"};function db(a){if(a instanceof H&&a.constructor===H&&a.b===cb)return a.a;u("expected object of type SafeUrl, got '"+a+"' of type "+q(a));return"type_error:SafeUrl"}var eb=/^(?:(?:https?|mailto|ftp):|[^&:/?#]*(?:[/?#]|$))/i;
|
|
34
|
-
function fb(a){if(a instanceof H)return a;a=a.i?a.h():String(a);eb.test(a)||(a="about:invalid#zClosurez");return gb(a)}var cb={};function gb(a){var b=new H;b.a=a;return b}gb("about:blank");function I(){this.a=hb}I.prototype.i=!0;I.prototype.h=function(){return""};I.prototype.v=!0;I.prototype.j=function(){return 1};I.prototype.toString=function(){return"TrustedResourceUrl{}"};var hb={};var J;a:{var ib=n.navigator;if(ib){var jb=ib.userAgent;if(jb){J=jb;break a}}J=""};function L(){this.a="";this.c=kb;this.b=null}L.prototype.v=!0;L.prototype.j=function(){return this.b};L.prototype.i=!0;L.prototype.h=function(){return this.a};L.prototype.toString=function(){return"SafeHtml{"+this.a+"}"};function M(a){if(a instanceof L&&a.constructor===L&&a.c===kb)return a.a;u("expected object of type SafeHtml, got '"+a+"' of type "+q(a));return"type_error:SafeHtml"}function lb(a){if(a instanceof L)return a;var b=null;a.v&&(b=a.j());a=la(a.i?a.h():String(a));return N(a,b)}
|
|
35
|
-
function O(a){if(a instanceof L)return a;a=lb(a);var b;b=M(a).replace(/ /g,"  ").replace(/(\r\n|\r|\n)/g,"<br>");return N(b,a.j())}var mb=/^[a-zA-Z0-9-]+$/,nb={action:!0,cite:!0,data:!0,formaction:!0,href:!0,manifest:!0,poster:!0,src:!0},ob={APPLET:!0,BASE:!0,EMBED:!0,IFRAME:!0,LINK:!0,MATH:!0,META:!0,OBJECT:!0,SCRIPT:!0,STYLE:!0,SVG:!0,TEMPLATE:!0};
|
|
36
|
-
function pb(a,b,c){if(!mb.test(a))throw Error("Invalid tag name <"+a+">.");if(a.toUpperCase()in ob)throw Error("Tag name <"+a+"> is not allowed for SafeHtml.");var d=null,f="<"+a;if(b)for(var g in b){if(!mb.test(g))throw Error('Invalid attribute name "'+g+'".');var e=b[g];if(null!=e){var l,m=a;l=g;if(e instanceof F)e=Xa(e);else if("style"==l.toLowerCase()){if(!ba(e))throw Error('The "style" attribute requires goog.html.SafeStyle or map of style properties, '+typeof e+" given: "+e);if(!(e instanceof
|
|
37
|
-
G)){var m="",w=void 0;for(w in e){if(!/^[-_a-zA-Z0-9]+$/.test(w))throw Error("Name allows only [-_a-zA-Z0-9], got: "+w);var k=e[w];if(null!=k){if(k instanceof F)k=Xa(k);else if(bb.test(k)){for(var h=!0,x=!0,p=0;p<k.length;p++){var K=k.charAt(p);"'"==K&&x?h=!h:'"'==K&&h&&(x=!x)}h&&x||(u("String value requires balanced quotes, got: "+k),k="zClosurez")}else u("String value allows only [-,.\"'%_!# a-zA-Z0-9], rgb() and rgba(), got: "+k),k="zClosurez";m+=w+":"+k+";"}}e=m?$a(m):ab}m=void 0;e instanceof
|
|
38
|
-
G&&e.constructor===G&&e.b===Za?m=e.a:(u("expected object of type SafeStyle, got '"+e+"' of type "+q(e)),m="type_error:SafeStyle");e=m}else{if(/^on/i.test(l))throw Error('Attribute "'+l+'" requires goog.string.Const value, "'+e+'" given.');if(l.toLowerCase()in nb)if(e instanceof I)e instanceof I&&e.constructor===I&&e.a===hb?e="":(u("expected object of type TrustedResourceUrl, got '"+e+"' of type "+q(e)),e="type_error:TrustedResourceUrl");else if(e instanceof H)e=db(e);else if(r(e))e=fb(e).h();else throw Error('Attribute "'+
|
|
39
|
-
l+'" on tag "'+m+'" requires goog.html.SafeUrl, goog.string.Const, or string, value "'+e+'" given.');}e.i&&(e=e.h());l=l+'="'+la(String(e))+'"';f=f+(" "+l)}}null!=c?"array"==q(c)||(c=[c]):c=[];!0===Va[a.toLowerCase()]?f+=">":(d=P(c),f+=">"+M(d)+"</"+a+">",d=d.j());(a=b&&b.dir)&&(/^(ltr|rtl|auto)$/i.test(a)?d=0:d=null);return N(f,d)}function P(a){function b(a){"array"==q(a)?wa(a,b):(a=lb(a),d+=M(a),a=a.j(),0==c?c=a:0!=a&&c!=a&&(c=null))}var c=0,d="";wa(arguments,b);return N(d,c)}var kb={};
|
|
40
|
-
function N(a,b){var c=new L;c.a=a;c.b=b;return c}N("<!DOCTYPE html>",0);var qb=N("",0),rb=N("<br>",0);function sb(a){var b;b=Error();if(Error.captureStackTrace)Error.captureStackTrace(b,a||sb),b=String(b.stack);else{try{throw b;}catch(c){b=c}b=(b=b.stack)?String(b):null}b||(b=tb(a||arguments.callee.caller,[]));return b}
|
|
41
|
-
function tb(a,b){var c=[];if(0<=va(b,a))c.push("[...circular reference...]");else if(a&&50>b.length){c.push(ub(a)+"(");for(var d=a.arguments,f=0;d&&f<d.length;f++){0<f&&c.push(", ");var g;g=d[f];switch(typeof g){case "object":g=g?"object":"null";break;case "string":break;case "number":g=String(g);break;case "boolean":g=g?"true":"false";break;case "function":g=(g=ub(g))?g:"[fn]";break;default:g=typeof g}40<g.length&&(g=g.substr(0,40)+"...");c.push(g)}b.push(a);c.push(")\n");try{c.push(tb(a.caller,
|
|
42
|
-
b))}catch(e){c.push("[exception trying to get caller]\n")}}else a?c.push("[...long stack...]"):c.push("[end]");return c.join("")}function ub(a){if(Q[a])return Q[a];a=String(a);if(!Q[a]){var b=/function ([^\(]+)/.exec(a);Q[a]=b?b[1]:"[Anonymous]"}return Q[a]}var Q={};function vb(a,b,c,d,f){"number"==typeof f||wb++;this.c=d||fa();this.f=a;this.b=b;this.g=c;delete this.a}vb.prototype.a=null;var wb=0;function xb(a){this.g=a;this.a=this.c=this.f=this.b=null}function R(a,b){this.name=a;this.value=b}R.prototype.toString=function(){return this.name};var yb=new R("SHOUT",1200),zb=new R("SEVERE",1E3),Ab=new R("WARNING",900),Bb=new R("INFO",800),Cb=new R("CONFIG",700);function Db(a){if(a.f)return a.f;if(a.b)return Db(a.b);u("Root logger has no level set.");return null}
|
|
43
|
-
xb.prototype.log=function(a,b,c){if(a.value>=Db(this).value)for("function"==q(b)&&(b=b()),a=new vb(a,String(b),this.g),c&&(a.a=c),c="log:"+a.b,n.console&&(n.console.timeStamp?n.console.timeStamp(c):n.console.markTimeline&&n.console.markTimeline(c)),n.msWriteProfilerMark&&n.msWriteProfilerMark(c),c=this;c;){b=c;var d=a;if(b.a)for(var f=0,g=void 0;g=b.a[f];f++)g(d);c=c.b}};var Eb={},S=null;function Fb(){S||(S=new xb(""),Eb[""]=S,S.f=Cb)}
|
|
44
|
-
function Gb(a){Fb();var b;if(!(b=Eb[a])){b=new xb(a);var c=a.lastIndexOf("."),d=a.substr(c+1),c=Gb(a.substr(0,c));c.c||(c.c={});c.c[d]=b;b.b=c;Eb[a]=b}return b};var Hb=new function(){this.a=fa()};function Ib(a){this.c=a||"";this.f=Hb}Ib.prototype.a=!0;Ib.prototype.b=!1;function T(a){return 10>a?"0"+a:String(a)}function Jb(a){Ib.call(this,a)}ga(Jb,Ib);Jb.prototype.b=!0;function Kb(a,b){Da(b,function(b,d){"style"==d?a.style.cssText=b:"class"==d?a.className=b:"for"==d?a.htmlFor=b:Lb.hasOwnProperty(d)?a.setAttribute(Lb[d],b):0==d.lastIndexOf("aria-",0)||0==d.lastIndexOf("data-",0)?a.setAttribute(d,b):a[d]=b})}var Lb={cellpadding:"cellPadding",cellspacing:"cellSpacing",colspan:"colSpan",frameborder:"frameBorder",height:"height",maxlength:"maxLength",role:"role",rowspan:"rowSpan",type:"type",usemap:"useMap",valign:"vAlign",width:"width"};
|
|
45
|
-
function Mb(a,b,c){function d(c){c&&b.appendChild(r(c)?a.createTextNode(c):c)}for(var f=2;f<c.length;f++){var g=c[f];!aa(g)||ba(g)&&0<g.nodeType?d(g):wa(Nb(g)?Ba(g):g,d)}}function Nb(a){if(a&&"number"==typeof a.length){if(ba(a))return"function"==typeof a.item||"string"==typeof a.item;if("function"==q(a))return"function"==typeof a.item}return!1}function Ob(a){this.b=a||n.document||document}
|
|
46
|
-
function Pb(a,b){var c;c=a.b;var d=b&&"*"!=b?b.toUpperCase():"";c.querySelectorAll&&c.querySelector&&d?c=c.querySelectorAll(d+""):c=c.getElementsByTagName(d||"*");return c}Ob.prototype.a=function(a,b,c){var d=this.b,f=arguments,g=f[1],e=d.createElement(f[0]);g&&(r(g)?e.className=g:"array"==q(g)?e.className=g.join(" "):Kb(e,g));2<f.length&&Mb(d,e,f);return e};
|
|
47
|
-
Ob.prototype.contains=function(a,b){if(!a||!b)return!1;if(a.contains&&1==b.nodeType)return a==b||a.contains(b);if("undefined"!=typeof a.compareDocumentPosition)return a==b||!!(a.compareDocumentPosition(b)&16);for(;b&&a!=b;)b=b.parentNode;return b==a};function Qb(a){this.m=ea(this.f,this);this.b=new Jb;this.c=this.b.a=!1;this.a=a;this.g=this.a.ownerDocument||this.a.document;a=(a=this.a)?new Ob(9==a.nodeType?a:a.ownerDocument||a.document):ia||(ia=new Ob);var b=null,c=Pb(a,"HEAD")[0];c||(b=Pb(a,"BODY")[0],c=a.a("HEAD"),b.parentNode.insertBefore(c,b));b=a.a("STYLE");b.innerHTML=".dbg-sev{color:#F00}.dbg-w{color:#C40}.dbg-sh{font-weight:bold;color:#000}.dbg-i{color:#444}.dbg-f{color:#999}.dbg-ev{color:#0A0}.dbg-m{color:#990}.logmsg{border-bottom:1px solid #CCC;padding:2px}.logsep{background-color: #8C8;}.logdiv{border:1px solid #CCC;background-color:#FCFCFC;font:medium monospace}";
|
|
48
|
-
c.appendChild(b);this.a.className+=" logdiv"}function Rb(a){if(1!=a.c){var b;Fb();b=S;var c=a.m;b.a||(b.a=[]);b.a.push(c);a.c=!0}}
|
|
49
|
-
Qb.prototype.f=function(a){if(a){var b=100>=this.a.scrollHeight-this.a.scrollTop-this.a.clientHeight,c=this.g.createElement("DIV");c.className="logmsg";var d;var f=this.b;if(a){switch(a.f.value){case yb.value:d="dbg-sh";break;case zb.value:d="dbg-sev";break;case Ab.value:d="dbg-w";break;case Bb.value:d="dbg-i";break;default:d="dbg-f"}var g=[];g.push(f.c," ");if(f.a){var e=new Date(a.c);g.push("[",T(e.getFullYear()-2E3)+T(e.getMonth()+1)+T(e.getDate())+" "+T(e.getHours())+":"+T(e.getMinutes())+":"+
|
|
50
|
-
T(e.getSeconds())+"."+T(Math.floor(e.getMilliseconds()/10)),"] ")}var e=(a.c-f.f.a)/1E3,l=e.toFixed(3),m=0;if(1>e)m=2;else for(;100>e;)m++,e*=10;for(;0<m--;)l=" "+l;g.push("[",l,"s] ");g.push("[",a.g,"] ");g=O(g.join(""));e=qb;if(f.b&&a.a){var w;try{var k;var h=a.a,x;d:{for(var f=["window","location","href"],e=n,p;p=f.shift();)if(null!=e[p])e=e[p];else{x=null;break d}x=e}if(r(h))k={message:h,name:"Unknown error",lineNumber:"Not available",fileName:x,stack:"Not available"};else{var K,ya;p=!1;try{K=
|
|
51
|
-
h.lineNumber||h.A||"Not available"}catch(za){K="Not available",p=!0}try{ya=h.fileName||h.filename||h.sourceURL||n.$googDebugFname||x}catch(za){ya="Not available",p=!0}k=!p&&h.lineNumber&&h.fileName&&h.stack&&h.message&&h.name?h:{message:h.message||"Not available",name:h.name||"UnknownError",lineNumber:K,fileName:ya,stack:h.stack||"Not available"}}var Aa;var ha=k.fileName;null!=ha||(ha="");if(/^https?:\/\//i.test(ha)){var cc=fb(ha);Ya("view-source scheme plus HTTP/HTTPS URL");var dc="view-source:"+
|
|
52
|
-
db(cc);Aa=gb(dc)}else{var ec=Ya("sanitizedviewsrc");Aa=gb(Xa(ec))}w=P(O("Message: "+k.message+"\nUrl: "),pb("a",{href:Aa,target:"_new"},k.fileName),O("\nLine: "+k.lineNumber+"\n\nBrowser stack:\n"+k.stack+"-> [end]\n\nJS stack traversal:\n"+sb(void 0)+"-> "))}catch(za){w=O("Exception trying to expose exception! You win, we lose. "+za)}e=P(rb,w)}a=O(a.b);d=pb("span",{"class":d},P(a,e));d=P(g,d,rb)}else d=qb;c.innerHTML=M(d);this.a.appendChild(c);b&&(this.a.scrollTop=this.a.scrollHeight)}};
|
|
53
|
-
Qb.prototype.clear=function(){this.a&&(this.a.innerHTML=M(qb))};function U(a,b){a&&a.log(Bb,b,void 0)};var Sb;if(-1!=J.indexOf("iPhone")&&-1==J.indexOf("iPod")&&-1==J.indexOf("iPad")||-1!=J.indexOf("iPad")||-1!=J.indexOf("iPod"))Sb="";else{var Tb=/Version\/([0-9.]+)/.exec(J);Sb=Tb?Tb[1]:""};for(var Ub=0,Vb=ka(String(Sb)).split("."),Wb=ka("6").split("."),Xb=Math.max(Vb.length,Wb.length),Yb=0;0==Ub&&Yb<Xb;Yb++){var Zb=Vb[Yb]||"",$b=Wb[Yb]||"",ac=/(\d*)(\D*)/g,bc=/(\d*)(\D*)/g;do{var V=ac.exec(Zb)||["","",""],W=bc.exec($b)||["","",""];if(0==V[0].length&&0==W[0].length)break;Ub=ta(0==V[1].length?0:parseInt(V[1],10),0==W[1].length?0:parseInt(W[1],10))||ta(0==V[2].length,0==W[2].length)||ta(V[2],W[2])}while(0==Ub)};var fc=JSON.stringify;function X(a,b,c){var d=a.constructor;if(a.window===a)try{var f=a.constructor;delete a.constructor;d=a.constructor;a.constructor=f}catch(g){}return d.prototype[b].apply(a,Ca(arguments,2))};Gb("safaridriver.message");function gc(a){this.a={};this.a[hc]="webdriver";this.a[ic]=a}var hc="origin",ic="type";function jc(a){var b=window;a.a[hc]="webdriver";if(b.postMessage){var c,b=function(a){c=a.data};X(window,"addEventListener","safaridriver.message.response",b,!1);kc(a.a);X(window,"removeEventListener","safaridriver.message.response",b,!1);return c}var d=X(document,"createEvent","Events");d.initEvent("beforeload",!1,!1);return b.canLoad(d,a.a)}
|
|
54
|
-
function kc(a){var b=X(document,"createEvent","MessageEvent");b.initMessageEvent("safaridriver.message",!1,!1,a,window.location.origin,"0",window,null);X(window,"dispatchEvent",b)}gc.prototype.toJSON=function(){return this.a};gc.prototype.toString=function(){return fc(this.toJSON())};function lc(a){gc.call(this,"connect");this.a.url=a}ga(lc,gc);function mc(){function a(){f+=1;jc(g)?(U(c,"Connected to extension"),U(c,"Requesting extension connect to client at "+d)):5>f?setTimeout(a,250*f):c&&c.log(zb,"Unable to establish a connection with the SafariDriver extension",void 0)}var b=document.createElement("h2");b.innerHTML="SafariDriver Launcher";document.body.appendChild(b);b=document.createElement("div");document.body.appendChild(b);Rb(new Qb(b));var c=Gb("safaridriver.client"),d=Ua();if(d){d=new z(d);U(c,"Connecting to SafariDriver browser extension...");
|
|
55
|
-
U(c,"This will fail if you have not installed the latest SafariDriver extension from\nhttp://selenium-release.storage.googleapis.com/index.html");U(c,"Extension logs may be viewed by clicking the Selenium [\u2713] button on the Safari toolbar");var f=0,g=new lc(d.toString());a()}else c&&c.log(zb,"No url specified. Please reload this page with the url parameter set",void 0)}var Y=["init"],Z=n;Y[0]in Z||!Z.execScript||Z.execScript("var "+Y[0]);
|
|
56
|
-
for(var nc;Y.length&&(nc=Y.shift());)Y.length||void 0===mc?Z[nc]?Z=Z[nc]:Z=Z[nc]={}:Z[nc]=mc;;window.onload = init;
|