selenium-webdriver 0.0.24 → 0.0.25
Sign up to get free protection for your applications and to get access to all the features.
- data/{common/src/rb/CHANGES → CHANGES} +13 -0
- data/{common/src/rb/README → README} +1 -1
- data/{common/src/rb/lib → lib}/selenium-webdriver.rb +0 -0
- data/{common/src/rb/lib → lib}/selenium/webdriver.rb +2 -1
- data/{common/src/rb/lib → lib}/selenium/webdriver/bridge_helper.rb +0 -0
- data/{common/src/rb/lib → lib}/selenium/webdriver/child_process.rb +0 -0
- data/{chrome/src/rb/lib → lib}/selenium/webdriver/chrome.rb +0 -0
- data/{chrome/src/rb/lib → lib}/selenium/webdriver/chrome/bridge.rb +2 -2
- data/{chrome/src/rb/lib → lib}/selenium/webdriver/chrome/command_executor.rb +0 -0
- data/lib/selenium/webdriver/chrome/extension.zip +0 -0
- data/{chrome/src/rb/lib → lib}/selenium/webdriver/chrome/launcher.rb +26 -20
- data/{common/src/rb/lib → lib}/selenium/webdriver/core_ext/dir.rb +0 -0
- data/{common/src/rb/lib → lib}/selenium/webdriver/core_ext/string.rb +0 -0
- data/{common/src/rb/lib → lib}/selenium/webdriver/driver.rb +0 -0
- data/{common/src/rb/lib → lib}/selenium/webdriver/driver_extensions/takes_screenshot.rb +0 -0
- data/{common/src/rb/lib → lib}/selenium/webdriver/element.rb +0 -0
- data/{common/src/rb/lib → lib}/selenium/webdriver/error.rb +0 -0
- data/{common/src/rb/lib → lib}/selenium/webdriver/file_reaper.rb +2 -1
- data/{common/src/rb/lib → lib}/selenium/webdriver/find.rb +0 -0
- data/{firefox/src/rb/lib → lib}/selenium/webdriver/firefox.rb +2 -1
- data/{firefox/src/rb/lib → lib}/selenium/webdriver/firefox/binary.rb +32 -6
- data/{firefox/src/rb/lib → lib}/selenium/webdriver/firefox/bridge.rb +0 -0
- data/lib/selenium/webdriver/firefox/extension/webdriver.xpi +0 -0
- data/{firefox/src/rb/lib → lib}/selenium/webdriver/firefox/launcher.rb +0 -0
- data/lib/selenium/webdriver/firefox/native/linux/amd64/x_ignore_nofocus.so +0 -0
- data/lib/selenium/webdriver/firefox/native/linux/x86/x_ignore_nofocus.so +0 -0
- data/{firefox/src/rb/lib → lib}/selenium/webdriver/firefox/profile.rb +37 -72
- data/{firefox/src/rb/lib → lib}/selenium/webdriver/firefox/profiles_ini.rb +0 -0
- data/{firefox/src/rb/lib → lib}/selenium/webdriver/firefox/util.rb +0 -0
- data/{jobbie/src/rb/lib → lib}/selenium/webdriver/ie.rb +2 -2
- data/{jobbie/src/rb/lib → lib}/selenium/webdriver/ie/bridge.rb +7 -2
- data/{jobbie/src/rb/lib → lib}/selenium/webdriver/ie/lib.rb +0 -0
- data/{jobbie/prebuilt/Win32/Release → lib/selenium/webdriver/ie/native/win32}/InternetExplorerDriver.dll +0 -0
- data/lib/selenium/webdriver/ie/native/x64/InternetExplorerDriver.dll +0 -0
- data/{jobbie/src/rb/lib → lib}/selenium/webdriver/ie/util.rb +0 -0
- data/{common/src/rb/lib → lib}/selenium/webdriver/keys.rb +0 -0
- data/{common/src/rb/lib → lib}/selenium/webdriver/navigation.rb +0 -0
- data/{common/src/rb/lib → lib}/selenium/webdriver/options.rb +0 -0
- data/{common/src/rb/lib → lib}/selenium/webdriver/platform.rb +5 -1
- data/{remote/client/src/rb/lib → lib}/selenium/webdriver/remote.rb +0 -0
- data/{remote/client/src/rb/lib → lib}/selenium/webdriver/remote/bridge.rb +0 -0
- data/{remote/client/src/rb/lib → lib}/selenium/webdriver/remote/capabilities.rb +0 -0
- data/{remote/client/src/rb/lib → lib}/selenium/webdriver/remote/commands.rb +0 -0
- data/{remote/client/src/rb/lib → lib}/selenium/webdriver/remote/http/common.rb +0 -0
- data/{remote/client/src/rb/lib → lib}/selenium/webdriver/remote/http/curb.rb +0 -0
- data/{remote/client/src/rb/lib → lib}/selenium/webdriver/remote/http/default.rb +5 -1
- data/{remote/client/src/rb/lib → lib}/selenium/webdriver/remote/response.rb +0 -0
- data/{remote/client/src/rb/lib → lib}/selenium/webdriver/remote/server_error.rb +0 -0
- data/{common/src/rb/lib → lib}/selenium/webdriver/target_locator.rb +0 -0
- data/{common/src/rb/lib → lib}/selenium/webdriver/timeouts.rb +0 -0
- data/lib/selenium/webdriver/zip_helper.rb +30 -0
- metadata +73 -214
- data/COPYING +0 -204
- data/chrome/prebuilt/Win32/Release/npchromedriver.dll +0 -0
- data/chrome/prebuilt/x64/Release/npchromedriver.dll +0 -0
- data/chrome/src/extension/background.html +0 -9
- data/chrome/src/extension/background.js +0 -1029
- data/chrome/src/extension/content_script.js +0 -1488
- data/chrome/src/extension/icons/busy.png +0 -0
- data/chrome/src/extension/icons/free.png +0 -0
- data/chrome/src/extension/manifest-nonwin.json +0 -19
- data/chrome/src/extension/manifest-win.json +0 -20
- data/chrome/src/extension/utils.js +0 -231
- data/common/src/js/abstractcommandprocessor.js +0 -132
- data/common/src/js/asserts.js +0 -296
- data/common/src/js/by.js +0 -149
- data/common/src/js/command.js +0 -380
- data/common/src/js/core/Blank.html +0 -7
- data/common/src/js/core/InjectedRemoteRunner.html +0 -8
- data/common/src/js/core/RemoteRunner.html +0 -101
- data/common/src/js/core/SeleniumLog.html +0 -109
- data/common/src/js/core/TestPrompt.html +0 -145
- data/common/src/js/core/TestRunner-splash.html +0 -55
- data/common/src/js/core/TestRunner.html +0 -165
- data/common/src/js/core/icons/all.png +0 -0
- data/common/src/js/core/icons/continue.png +0 -0
- data/common/src/js/core/icons/continue_disabled.png +0 -0
- data/common/src/js/core/icons/pause.png +0 -0
- data/common/src/js/core/icons/pause_disabled.png +0 -0
- data/common/src/js/core/icons/selected.png +0 -0
- data/common/src/js/core/icons/step.png +0 -0
- data/common/src/js/core/icons/step_disabled.png +0 -0
- data/common/src/js/core/lib/cssQuery/cssQuery-p.js +0 -6
- data/common/src/js/core/lib/cssQuery/src/cssQuery-level2.js +0 -142
- data/common/src/js/core/lib/cssQuery/src/cssQuery-level3.js +0 -150
- data/common/src/js/core/lib/cssQuery/src/cssQuery-standard.js +0 -53
- data/common/src/js/core/lib/cssQuery/src/cssQuery.js +0 -356
- data/common/src/js/core/lib/prototype.js +0 -2006
- data/common/src/js/core/lib/scriptaculous/builder.js +0 -101
- data/common/src/js/core/lib/scriptaculous/controls.js +0 -815
- data/common/src/js/core/lib/scriptaculous/dragdrop.js +0 -915
- data/common/src/js/core/lib/scriptaculous/effects.js +0 -958
- data/common/src/js/core/lib/scriptaculous/scriptaculous.js +0 -47
- data/common/src/js/core/lib/scriptaculous/slider.js +0 -283
- data/common/src/js/core/lib/scriptaculous/unittest.js +0 -383
- data/common/src/js/core/lib/snapsie.js +0 -91
- data/common/src/js/core/scripts/find_matching_child.js +0 -69
- data/common/src/js/core/scripts/htmlutils.js +0 -8716
- data/common/src/js/core/scripts/injection.html +0 -72
- data/common/src/js/core/scripts/selenium-api.js +0 -3291
- data/common/src/js/core/scripts/selenium-browserbot.js +0 -2457
- data/common/src/js/core/scripts/selenium-browserdetect.js +0 -153
- data/common/src/js/core/scripts/selenium-commandhandlers.js +0 -379
- data/common/src/js/core/scripts/selenium-executionloop.js +0 -175
- data/common/src/js/core/scripts/selenium-logging.js +0 -148
- data/common/src/js/core/scripts/selenium-remoterunner.js +0 -695
- data/common/src/js/core/scripts/selenium-testrunner.js +0 -1362
- data/common/src/js/core/scripts/selenium-version.js +0 -5
- data/common/src/js/core/scripts/ui-doc.html +0 -808
- data/common/src/js/core/scripts/ui-element.js +0 -1644
- data/common/src/js/core/scripts/ui-map-sample.js +0 -979
- data/common/src/js/core/scripts/user-extensions.js +0 -3
- data/common/src/js/core/scripts/user-extensions.js.sample +0 -75
- data/common/src/js/core/scripts/xmlextras.js +0 -153
- data/common/src/js/core/selenium-logo.png +0 -0
- data/common/src/js/core/selenium-test.css +0 -43
- data/common/src/js/core/selenium.css +0 -316
- data/common/src/js/core/xpath/dom.js +0 -566
- data/common/src/js/core/xpath/javascript-xpath-0.1.11.js +0 -2816
- data/common/src/js/core/xpath/util.js +0 -549
- data/common/src/js/core/xpath/xmltoken.js +0 -149
- data/common/src/js/core/xpath/xpath.js +0 -2481
- data/common/src/js/extension/README +0 -2
- data/common/src/js/extension/dommessenger.js +0 -152
- data/common/src/js/factory.js +0 -55
- data/common/src/js/future.js +0 -141
- data/common/src/js/jsunit.js +0 -40
- data/common/src/js/jsunit/app/css/jsUnitStyle.css +0 -50
- data/common/src/js/jsunit/app/css/readme +0 -10
- data/common/src/js/jsunit/app/emptyPage.html +0 -11
- data/common/src/js/jsunit/app/jsUnitCore.js +0 -534
- data/common/src/js/jsunit/app/jsUnitMockTimeout.js +0 -81
- data/common/src/js/jsunit/app/jsUnitTestManager.js +0 -705
- data/common/src/js/jsunit/app/jsUnitTestSuite.js +0 -44
- data/common/src/js/jsunit/app/jsUnitTracer.js +0 -102
- data/common/src/js/jsunit/app/jsUnitVersionCheck.js +0 -59
- data/common/src/js/jsunit/app/main-counts-errors.html +0 -12
- data/common/src/js/jsunit/app/main-counts-failures.html +0 -13
- data/common/src/js/jsunit/app/main-counts-runs.html +0 -13
- data/common/src/js/jsunit/app/main-counts.html +0 -21
- data/common/src/js/jsunit/app/main-data.html +0 -178
- data/common/src/js/jsunit/app/main-errors.html +0 -23
- data/common/src/js/jsunit/app/main-frame.html +0 -19
- data/common/src/js/jsunit/app/main-loader.html +0 -45
- data/common/src/js/jsunit/app/main-progress.html +0 -25
- data/common/src/js/jsunit/app/main-results.html +0 -67
- data/common/src/js/jsunit/app/main-status.html +0 -13
- data/common/src/js/jsunit/app/testContainer.html +0 -16
- data/common/src/js/jsunit/app/testContainerController.html +0 -77
- data/common/src/js/jsunit/app/xbDebug.js +0 -306
- data/common/src/js/jsunit/changelog.txt +0 -60
- data/common/src/js/jsunit/css/jsUnitStyle.css +0 -83
- data/common/src/js/jsunit/images/green.gif +0 -0
- data/common/src/js/jsunit/images/logo_jsunit.gif +0 -0
- data/common/src/js/jsunit/images/powerby-transparent.gif +0 -0
- data/common/src/js/jsunit/images/red.gif +0 -0
- data/common/src/js/jsunit/licenses/JDOM_license.txt +0 -56
- data/common/src/js/jsunit/licenses/Jetty_license.html +0 -213
- data/common/src/js/jsunit/licenses/MPL-1.1.txt +0 -470
- data/common/src/js/jsunit/licenses/gpl-2.txt +0 -340
- data/common/src/js/jsunit/licenses/index.html +0 -141
- data/common/src/js/jsunit/licenses/lgpl-2.1.txt +0 -504
- data/common/src/js/jsunit/licenses/mpl-tri-license-c.txt +0 -35
- data/common/src/js/jsunit/licenses/mpl-tri-license-html.txt +0 -35
- data/common/src/js/jsunit/readme.txt +0 -19
- data/common/src/js/jsunit/testRunner.html +0 -167
- data/common/src/js/jsunit/version.txt +0 -1
- data/common/src/js/key.js +0 -117
- data/common/src/js/localcommandprocessor.js +0 -171
- data/common/src/js/testcase.js +0 -219
- data/common/src/js/timing.js +0 -89
- data/common/src/js/webdriver.js +0 -860
- data/common/src/js/webelement.js +0 -483
- data/firefox/prebuilt/Win32/Release/webdriver-firefox.dll +0 -0
- data/firefox/prebuilt/amd64/libnoblur64.so +0 -0
- data/firefox/prebuilt/i386/libnoblur.so +0 -0
- data/firefox/prebuilt/linux/Release/libwebdriver-firefox.so +0 -0
- data/firefox/prebuilt/linux64/Release/libwebdriver-firefox.so +0 -0
- data/firefox/prebuilt/nsICommandProcessor.xpt +0 -0
- data/firefox/prebuilt/nsINativeEvents.xpt +0 -0
- data/firefox/prebuilt/nsIResponseHandler.xpt +0 -0
- data/firefox/src/extension/chrome.manifest +0 -3
- data/firefox/src/extension/components/badCertListener.js +0 -295
- data/firefox/src/extension/components/dispatcher.js +0 -495
- data/firefox/src/extension/components/driver-component.js +0 -130
- data/firefox/src/extension/components/errorcode.js +0 -70
- data/firefox/src/extension/components/firefoxDriver.js +0 -831
- data/firefox/src/extension/components/json2.js +0 -273
- data/firefox/src/extension/components/keytest.html +0 -554
- data/firefox/src/extension/components/nsCommandProcessor.js +0 -684
- data/firefox/src/extension/components/promptService.js +0 -208
- data/firefox/src/extension/components/request.js +0 -219
- data/firefox/src/extension/components/response.js +0 -276
- data/firefox/src/extension/components/screenshooter.js +0 -81
- data/firefox/src/extension/components/session.js +0 -314
- data/firefox/src/extension/components/sessionstore.js +0 -226
- data/firefox/src/extension/components/socketListener.js +0 -435
- data/firefox/src/extension/components/utils.js +0 -1335
- data/firefox/src/extension/components/webLoadingListener.js +0 -57
- data/firefox/src/extension/components/webdriverserver.js +0 -110
- data/firefox/src/extension/components/wrappedElement.js +0 -706
- data/firefox/src/extension/content/fxdriver.xul +0 -30
- data/firefox/src/extension/content/server.js +0 -95
- data/firefox/src/extension/idl/nsICommandProcessor.idl +0 -38
- data/firefox/src/extension/idl/nsIResponseHandler.idl +0 -34
- data/firefox/src/extension/install.rdf +0 -29
- data/jobbie/prebuilt/x64/Release/InternetExplorerDriver.dll +0 -0
data/common/src/js/by.js
DELETED
@@ -1,149 +0,0 @@
|
|
1
|
-
/** @license
|
2
|
-
Copyright 2007-2009 WebDriver committers
|
3
|
-
Copyright 2007-2009 Google Inc.
|
4
|
-
|
5
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
you may not use this file except in compliance with the License.
|
7
|
-
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, software
|
12
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
See the License for the specific language governing permissions and
|
15
|
-
limitations under the License.
|
16
|
-
*/
|
17
|
-
|
18
|
-
/**
|
19
|
-
* @fileoverview Factory methods for the supported locator strategies.
|
20
|
-
* @author jmleyba@gmail.com (Jason Leyba)
|
21
|
-
*/
|
22
|
-
|
23
|
-
goog.provide('webdriver.By');
|
24
|
-
goog.provide('webdriver.By.Locator');
|
25
|
-
goog.provide('webdriver.By.Strategy');
|
26
|
-
|
27
|
-
goog.require('goog.object');
|
28
|
-
goog.require('goog.string');
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
/**
|
33
|
-
* An element locator.
|
34
|
-
* @param {webdriver.By.Strategy} type The type of strategy to use for this
|
35
|
-
* locator.
|
36
|
-
* @param {string} target The target of this locator.
|
37
|
-
* @constructor
|
38
|
-
*/
|
39
|
-
webdriver.By.Locator = function(type, target) {
|
40
|
-
this.type = type;
|
41
|
-
this.target = target;
|
42
|
-
};
|
43
|
-
|
44
|
-
|
45
|
-
/**
|
46
|
-
* Creates a new Locator from an object whose only property is also a key in
|
47
|
-
* the {@code webdriver.By.Strategy} enumeration. This property will be the
|
48
|
-
* locator type; its value will be the locator target.
|
49
|
-
* @param {{*: string}} obj The object to convert into a Locator.
|
50
|
-
* @return {webdriver.By.Locator} The new locator object.
|
51
|
-
* @throws If {@code obj} could not be converted.
|
52
|
-
*/
|
53
|
-
webdriver.By.Locator.createFromObj = function(obj) {
|
54
|
-
var key = goog.object.getAnyKey(obj);
|
55
|
-
if (key && key in webdriver.By.Strategy) {
|
56
|
-
return new webdriver.By.Locator(webdriver.By.Strategy[key], obj[key]);
|
57
|
-
}
|
58
|
-
throw new Error('Unsupported locator strategy: ' + key);
|
59
|
-
};
|
60
|
-
|
61
|
-
|
62
|
-
/**
|
63
|
-
* Verifies that a {@code locator} is a valid locator to use for searching for
|
64
|
-
* elements on the page.
|
65
|
-
* @param {webdriver.By.Locator|{*: string}} locator The locator to verify, or
|
66
|
-
* a short-hand object that can be converted into a locator to verify.
|
67
|
-
* @return {webdriver.By.Locator} The validated locator.
|
68
|
-
* @throws If the {@code locator} is not valid.
|
69
|
-
*/
|
70
|
-
webdriver.By.Locator.checkLocator = function(locator) {
|
71
|
-
if (!locator.type || !locator.target) {
|
72
|
-
locator = webdriver.By.Locator.createFromObj(locator);
|
73
|
-
}
|
74
|
-
|
75
|
-
if (locator.type == webdriver.By.Strategy.className) {
|
76
|
-
var normalized = goog.string.normalizeWhitespace(locator.target);
|
77
|
-
locator.target = goog.string.trim(normalized);
|
78
|
-
if (locator.target.search(/\s/) >= 0) {
|
79
|
-
throw new Error('Compound class names are not allowed for searches: ' +
|
80
|
-
goog.string.quote(locator.target));
|
81
|
-
}
|
82
|
-
}
|
83
|
-
|
84
|
-
return locator;
|
85
|
-
};
|
86
|
-
|
87
|
-
|
88
|
-
/**
|
89
|
-
* Enumeration of the supported strategies for finding {@code Element}s on the
|
90
|
-
* page. For all strategies, if there is more than one possible match, the
|
91
|
-
* first element encountered will be returned.
|
92
|
-
* @enum {string}
|
93
|
-
*/
|
94
|
-
webdriver.By.Strategy = {
|
95
|
-
|
96
|
-
/**
|
97
|
-
* Find an element by its ID.
|
98
|
-
*/
|
99
|
-
id: 'id',
|
100
|
-
|
101
|
-
/**
|
102
|
-
* Find an element by the value of its name attribute.
|
103
|
-
*/
|
104
|
-
name: 'name',
|
105
|
-
|
106
|
-
/**
|
107
|
-
* Find an element by one of its class names. Only one class name may be
|
108
|
-
* specified per search.
|
109
|
-
*/
|
110
|
-
className: 'class name',
|
111
|
-
|
112
|
-
/**
|
113
|
-
* Find an A tag by its text context.
|
114
|
-
*/
|
115
|
-
linkText: 'link text',
|
116
|
-
|
117
|
-
/**
|
118
|
-
* Find an A tag by partially matching its text context.
|
119
|
-
*/
|
120
|
-
partialLinkText: 'partial link text',
|
121
|
-
|
122
|
-
/**
|
123
|
-
* Find an element by its tagName property.
|
124
|
-
*/
|
125
|
-
tagName: 'tag name',
|
126
|
-
|
127
|
-
/**
|
128
|
-
* Find an element by evaluating an XPath expression.
|
129
|
-
*/
|
130
|
-
xpath: 'xpath',
|
131
|
-
|
132
|
-
/**
|
133
|
-
* Find an element by evaluating a javascript expression.
|
134
|
-
*/
|
135
|
-
js: 'js'
|
136
|
-
};
|
137
|
-
|
138
|
-
|
139
|
-
/**
|
140
|
-
* Map each of the supported strategies to a factory function in the
|
141
|
-
* {@code webdriver.By} namespace.
|
142
|
-
*/
|
143
|
-
goog.object.forEach(webdriver.By.Strategy, function(name, key) {
|
144
|
-
webdriver.By[key] = function(target) {
|
145
|
-
return new webdriver.By.Locator(name, target);
|
146
|
-
};
|
147
|
-
});
|
148
|
-
|
149
|
-
goog.exportSymbol('By', webdriver.By);
|
data/common/src/js/command.js
DELETED
@@ -1,380 +0,0 @@
|
|
1
|
-
/** @license
|
2
|
-
Copyright 2007-2009 WebDriver committers
|
3
|
-
Copyright 2007-2009 Google Inc.
|
4
|
-
|
5
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
you may not use this file except in compliance with the License.
|
7
|
-
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, software
|
12
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
See the License for the specific language governing permissions and
|
15
|
-
limitations under the License.
|
16
|
-
*/
|
17
|
-
|
18
|
-
/**
|
19
|
-
* @fileoverview Contains several classes for handling commands.
|
20
|
-
* @author jmleyba@gmail.com (Jason Leyba)
|
21
|
-
*/
|
22
|
-
|
23
|
-
goog.provide('webdriver.Command');
|
24
|
-
goog.provide('webdriver.CommandName');
|
25
|
-
goog.provide('webdriver.Response');
|
26
|
-
goog.provide('webdriver.Response.Code');
|
27
|
-
|
28
|
-
goog.require('goog.array');
|
29
|
-
goog.require('goog.events.EventTarget');
|
30
|
-
goog.require('goog.testing.stacktrace');
|
31
|
-
goog.require('webdriver.Future');
|
32
|
-
|
33
|
-
|
34
|
-
/**
|
35
|
-
* Describes a command to be executed by a
|
36
|
-
* {@code webdriver.AbstractCommandProcessor}.
|
37
|
-
* @param {webdriver.WebDriver} driver The driver that this is a command for.
|
38
|
-
* @param {webdriver.CommandName} name The name of this command.
|
39
|
-
* @constructor
|
40
|
-
* @extends {goog.events.EventTarget}
|
41
|
-
*/
|
42
|
-
webdriver.Command = function(driver, name) {
|
43
|
-
goog.events.EventTarget.call(this);
|
44
|
-
|
45
|
-
/**
|
46
|
-
* The driver that this is a command to.
|
47
|
-
* @type {webdriver.WebDriver}
|
48
|
-
* @private
|
49
|
-
*/
|
50
|
-
this.driver_ = driver;
|
51
|
-
|
52
|
-
/**
|
53
|
-
* A future that will be automatically updated with the value of this
|
54
|
-
* command's response when it is ready. If the command fails, the
|
55
|
-
* future's value will not be set.
|
56
|
-
* @type {webdriver.Future}
|
57
|
-
* @private
|
58
|
-
*/
|
59
|
-
this.futureResult_ = new webdriver.Future(this.driver_);
|
60
|
-
|
61
|
-
/**
|
62
|
-
* The name of this command.
|
63
|
-
* @type {webdriver.CommandName}
|
64
|
-
*/
|
65
|
-
this.name = name;
|
66
|
-
|
67
|
-
/**
|
68
|
-
* The parameters to this command.
|
69
|
-
* @type {Object}
|
70
|
-
*/
|
71
|
-
this.parameters = {};
|
72
|
-
|
73
|
-
/**
|
74
|
-
* The response to this command.
|
75
|
-
* @type {?webdriver.Response}
|
76
|
-
*/
|
77
|
-
this.response = null;
|
78
|
-
|
79
|
-
};
|
80
|
-
goog.inherits(webdriver.Command, goog.events.EventTarget);
|
81
|
-
|
82
|
-
|
83
|
-
/**
|
84
|
-
* The event dispatched by a command when it fails.
|
85
|
-
* @type {string}
|
86
|
-
*/
|
87
|
-
webdriver.Command.ERROR_EVENT = 'ERROR';
|
88
|
-
|
89
|
-
|
90
|
-
/** @override */
|
91
|
-
webdriver.Command.prototype.disposeInternal = function() {
|
92
|
-
webdriver.Command.superClass_.disposeInternal.call(this);
|
93
|
-
this.futureResult_.dispose();
|
94
|
-
delete this.driver_;
|
95
|
-
delete this.futureResult_;
|
96
|
-
delete this.name;
|
97
|
-
delete this.parameters;
|
98
|
-
delete this.response;
|
99
|
-
};
|
100
|
-
|
101
|
-
|
102
|
-
/** @override */
|
103
|
-
webdriver.Command.prototype.toString = function() {
|
104
|
-
return this.name;
|
105
|
-
};
|
106
|
-
|
107
|
-
|
108
|
-
/**
|
109
|
-
* @return {webdriver.WebDriver} The driver that this is a command to.
|
110
|
-
*/
|
111
|
-
webdriver.Command.prototype.getDriver = function() {
|
112
|
-
return this.driver_;
|
113
|
-
};
|
114
|
-
|
115
|
-
|
116
|
-
/**
|
117
|
-
* @return {webdriver.CommandName} This command's name.
|
118
|
-
*/
|
119
|
-
webdriver.Command.prototype.getName = function() {
|
120
|
-
return this.name;
|
121
|
-
};
|
122
|
-
|
123
|
-
|
124
|
-
/**
|
125
|
-
* @return {webdriver.Future} The future result (value-only) of this command.
|
126
|
-
*/
|
127
|
-
webdriver.Command.prototype.getFutureResult = function() {
|
128
|
-
return this.futureResult_;
|
129
|
-
};
|
130
|
-
|
131
|
-
|
132
|
-
/**
|
133
|
-
* @return {boolean} Whether this command has finished; aborted commands are
|
134
|
-
* never considered finished.
|
135
|
-
*/
|
136
|
-
webdriver.Command.prototype.isFinished = function() {
|
137
|
-
return !!this.response;
|
138
|
-
};
|
139
|
-
|
140
|
-
|
141
|
-
/**
|
142
|
-
* Sets a parameter to send with this command.
|
143
|
-
* @param {string} name The parameter name.
|
144
|
-
* @param {*} var_args The parameter value.
|
145
|
-
* @return {webdriver.Command} A self reference.
|
146
|
-
*/
|
147
|
-
webdriver.Command.prototype.setParameter = function(name, value) {
|
148
|
-
this.parameters[name] = value;
|
149
|
-
return this;
|
150
|
-
};
|
151
|
-
|
152
|
-
|
153
|
-
/**
|
154
|
-
* @return {Object} The parameters to send with this command.
|
155
|
-
*/
|
156
|
-
webdriver.Command.prototype.getParameters = function() {
|
157
|
-
return this.parameters;
|
158
|
-
};
|
159
|
-
|
160
|
-
|
161
|
-
/**
|
162
|
-
* @return {?webdriver.Response} The response to this command if it is ready.
|
163
|
-
*/
|
164
|
-
webdriver.Command.prototype.getResponse = function() {
|
165
|
-
return this.response;
|
166
|
-
};
|
167
|
-
|
168
|
-
|
169
|
-
/**
|
170
|
-
* Set the response for this command. The response may only be set once; any
|
171
|
-
* repeat calls will be ignored.
|
172
|
-
* @param {webdriver.Response} response The response.
|
173
|
-
* @throws If the response was already set.
|
174
|
-
*/
|
175
|
-
webdriver.Command.prototype.setResponse = function(response) {
|
176
|
-
if (this.isDisposed() || this.isFinished()) {
|
177
|
-
return;
|
178
|
-
}
|
179
|
-
this.response = response;
|
180
|
-
if (this.response.getStatus() == webdriver.Response.Code.SUCCESS) {
|
181
|
-
this.futureResult_.setValue(this.response.getValue());
|
182
|
-
} else {
|
183
|
-
this.dispatchEvent(webdriver.Command.ERROR_EVENT);
|
184
|
-
}
|
185
|
-
};
|
186
|
-
|
187
|
-
|
188
|
-
/**
|
189
|
-
* Enumeration of predefined names command names that all command processors
|
190
|
-
* will support.
|
191
|
-
* @enum {string}
|
192
|
-
*/
|
193
|
-
webdriver.CommandName = {
|
194
|
-
// Commands executed directly by the JS API. --------------------------------
|
195
|
-
FUNCTION: 'function',
|
196
|
-
SLEEP: 'sleep',
|
197
|
-
WAIT: 'wait',
|
198
|
-
PAUSE: 'pause',
|
199
|
-
|
200
|
-
// Commands dispatched to the browser driver. -------------------------------
|
201
|
-
NEW_SESSION: 'newSession',
|
202
|
-
DELETE_SESSION: 'deleteSession',
|
203
|
-
|
204
|
-
CLOSE: 'close',
|
205
|
-
QUIT: 'quit',
|
206
|
-
|
207
|
-
GET: 'get',
|
208
|
-
GO_BACK: 'goBack',
|
209
|
-
GO_FORWARD: 'goForward',
|
210
|
-
REFRESH: 'refresh',
|
211
|
-
|
212
|
-
ADD_COOKIE: 'addCookie',
|
213
|
-
GET_COOKIE: 'getCookie',
|
214
|
-
GET_ALL_COOKIES: 'getCookies',
|
215
|
-
DELETE_COOKIE: 'deleteCookie',
|
216
|
-
DELETE_ALL_COOKIES: 'deleteAllCookies',
|
217
|
-
|
218
|
-
FIND_ELEMENT: 'findElement',
|
219
|
-
FIND_ELEMENTS: 'findElements',
|
220
|
-
FIND_CHILD_ELEMENT: 'findChildElement',
|
221
|
-
FIND_CHILD_ELEMENTS: 'findChildElements',
|
222
|
-
|
223
|
-
CLEAR_ELEMENT: 'clearElement',
|
224
|
-
CLICK_ELEMENT: 'clickElement',
|
225
|
-
HOVER_OVER_ELEMNET: 'hoverOverElement',
|
226
|
-
SEND_KEYS_TO_ELEMENT: 'sendKeysToElement',
|
227
|
-
SUBMIT_ELEMENT: 'submitElement',
|
228
|
-
TOGGLE_ELEMENT: 'toggleElement',
|
229
|
-
|
230
|
-
GET_CURRENT_WINDOW_HANDLE: 'getCurrentWindowHandle',
|
231
|
-
GET_WINDOW_HANDLES: 'getWindowHandles',
|
232
|
-
|
233
|
-
SWITCH_TO_WINDOW: 'switchToWindow',
|
234
|
-
SWITCH_TO_FRAME: 'switchToFrame',
|
235
|
-
SWITCH_TO_DEFAULT_CONTENT: 'switchToDefaultContent',
|
236
|
-
GET_ACTIVE_ELEMENT: 'getActiveElement',
|
237
|
-
|
238
|
-
GET_CURRENT_URL: 'getCurrentUrl',
|
239
|
-
GET_PAGE_SOURCE: 'getPageSource',
|
240
|
-
GET_TITLE: 'getTitle',
|
241
|
-
|
242
|
-
EXECUTE_SCRIPT: 'executeScript',
|
243
|
-
|
244
|
-
GET_SPEED: 'getSpeed',
|
245
|
-
SET_SPEED: 'setSpeed',
|
246
|
-
|
247
|
-
SET_BROWSE_VISIBLE: 'setBrowserVisible',
|
248
|
-
IS_BROWSER_VISIBLE: 'isBrowserVisible',
|
249
|
-
|
250
|
-
GET_ELEMENT_TEXT: 'getElementText',
|
251
|
-
GET_ELEMENT_VALUE: 'getElementValue',
|
252
|
-
GET_ELEMENT_TAG_NAME: 'getElementTagName',
|
253
|
-
SET_ELEMENT_SELECTED: 'setElementSelected',
|
254
|
-
DRAG_ELEMENT: 'dragElement',
|
255
|
-
IS_ELEMENT_SELECTED: 'isElementSelected',
|
256
|
-
IS_ELEMENT_ENABLED: 'isElementEnabled',
|
257
|
-
IS_ELEMENT_DISPLAYED: 'isElementDisplayed',
|
258
|
-
GET_ELEMENT_LOCATION: 'getElementLocation',
|
259
|
-
GET_ELEMENT_LOCATION_ONCE_SCROLLED_INTO_VIEW:
|
260
|
-
'getElementLocationOnceScrolledIntoView',
|
261
|
-
GET_ELEMENT_SIZE: 'getElementSize',
|
262
|
-
GET_ELEMENT_ATTRIBUTE: 'getElementAttribute',
|
263
|
-
GET_ELEMENT_VALUE_OF_CSS_PROPERTY: 'getElementValueOfCssProperty',
|
264
|
-
ELEMENT_EQUALS: 'elementEquals',
|
265
|
-
|
266
|
-
SCREENSHOT: 'screenshot',
|
267
|
-
DIMISS_ALERT: 'dimissAlert'
|
268
|
-
};
|
269
|
-
|
270
|
-
|
271
|
-
/**
|
272
|
-
* Encapsulates a response to a {@code webdriver.Command}.
|
273
|
-
* @param {webdriver.Response.Code} status The status code for this response.
|
274
|
-
* @param {*} value The value of the response, the meaning of which depends
|
275
|
-
* on the command.
|
276
|
-
* @constructor
|
277
|
-
*/
|
278
|
-
webdriver.Response = function(status, value) {
|
279
|
-
|
280
|
-
/**
|
281
|
-
* The status code for this response.
|
282
|
-
* @type {webdriver.Response.Code}
|
283
|
-
* @private
|
284
|
-
*/
|
285
|
-
this.status_ = status;
|
286
|
-
|
287
|
-
/**
|
288
|
-
* The value for this response.
|
289
|
-
* @type {*}
|
290
|
-
* @private
|
291
|
-
*/
|
292
|
-
this.value_ = value;
|
293
|
-
};
|
294
|
-
|
295
|
-
|
296
|
-
/** @return {webdriver.Response.Code} The status code for this response. */
|
297
|
-
webdriver.Response.prototype.getStatus = function() {
|
298
|
-
return this.status_;
|
299
|
-
};
|
300
|
-
|
301
|
-
|
302
|
-
/** @return {*} The value of this response. */
|
303
|
-
webdriver.Response.prototype.getValue = function() {
|
304
|
-
return this.value_;
|
305
|
-
};
|
306
|
-
|
307
|
-
|
308
|
-
/** @return {!boolean} Whether this is a response to a successful command. */
|
309
|
-
webdriver.Response.prototype.isSuccess = function() {
|
310
|
-
return this.status_ == webdriver.Response.Code.SUCCESS;
|
311
|
-
};
|
312
|
-
|
313
|
-
|
314
|
-
/**
|
315
|
-
* @return {?string} A formatted error message, or {@code null} if this is not a
|
316
|
-
* failure response.
|
317
|
-
*/
|
318
|
-
webdriver.Response.prototype.getErrorMessage = function() {
|
319
|
-
if (this.status_ == webdriver.Response.Code.SUCCESS) {
|
320
|
-
return null;
|
321
|
-
}
|
322
|
-
|
323
|
-
if (!this.value_) {
|
324
|
-
return 'Unknown error'; // Really should never happen
|
325
|
-
}
|
326
|
-
|
327
|
-
if (goog.isDef(this.value_['message'])) {
|
328
|
-
var message = [this.value_['message']];
|
329
|
-
|
330
|
-
var stackTrace = this.value_['stackTrace'];
|
331
|
-
if (goog.isArray(stackTrace)) {
|
332
|
-
goog.array.extend(message, goog.array.map(this.value_['stackTrace'],
|
333
|
-
function(frame) {
|
334
|
-
var buffer = [];
|
335
|
-
|
336
|
-
// className is provided by remote java servers
|
337
|
-
var className = frame['className'];
|
338
|
-
if (goog.isDef(className)) {
|
339
|
-
buffer.push(className + '.');
|
340
|
-
}
|
341
|
-
buffer.push(frame['methodName'] || '<anonymous function>');
|
342
|
-
buffer.push('() at ');
|
343
|
-
// fileName will be undefined if the method call was to an XPCOM
|
344
|
-
// interface.
|
345
|
-
buffer.push(frame['fileName'] || '<unknown file>');
|
346
|
-
buffer.push(':');
|
347
|
-
buffer.push(frame['lineNumber']);
|
348
|
-
return buffer.join('');
|
349
|
-
}));
|
350
|
-
} else if (goog.isDef(stackTrace)) {
|
351
|
-
message.push(stackTrace);
|
352
|
-
} else if (goog.isDef(this.value_.stack)) {
|
353
|
-
message.push(goog.testing.stacktrace.canonicalize(this.value_.stack));
|
354
|
-
}
|
355
|
-
return message.join('\n');
|
356
|
-
} else {
|
357
|
-
return this.value_.toString();
|
358
|
-
}
|
359
|
-
};
|
360
|
-
|
361
|
-
|
362
|
-
/**
|
363
|
-
* Error codes used by the wire protocol.
|
364
|
-
* @enum {number}
|
365
|
-
*/
|
366
|
-
webdriver.Response.Code = {
|
367
|
-
/* keep in sync with codes in org.openqa.selenium.remote.ErrorCodes */
|
368
|
-
SUCCESS: 0,
|
369
|
-
COOKIE_ERROR: 2,
|
370
|
-
NO_SUCH_WINDOW: 3,
|
371
|
-
NO_SUCH_ELEMENT: 7,
|
372
|
-
NO_SUCH_FRAME: 8,
|
373
|
-
UNKNOWN_COMMAND: 9,
|
374
|
-
STALE_ELEMENT_REFERENCE: 10,
|
375
|
-
ELEMENT_NOT_VISIBLE: 11,
|
376
|
-
INVALID_ELEMENT_STATE: 12,
|
377
|
-
UNHANDLED_ERROR: 13,
|
378
|
-
UNEXPECTED_JAVASCRIPT_ERROR: 17,
|
379
|
-
XPATH_LOOKUP_ERROR: 19
|
380
|
-
};
|