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
@@ -1,81 +0,0 @@
|
|
1
|
-
/*
|
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
|
-
function Screenshooter() {
|
20
|
-
}
|
21
|
-
|
22
|
-
|
23
|
-
Screenshooter.grab = function(window) {
|
24
|
-
var document = window.document;
|
25
|
-
var documentElement = document.documentElement;
|
26
|
-
var canvas = document.getElementById('fxdriver-screenshot-canvas');
|
27
|
-
if (canvas == null) {
|
28
|
-
canvas = document.createElement('canvas');
|
29
|
-
canvas.id = 'fxdriver-screenshot-canvas';
|
30
|
-
canvas.style.display = 'none';
|
31
|
-
documentElement.appendChild(canvas);
|
32
|
-
}
|
33
|
-
var width =
|
34
|
-
Math.max(documentElement.scrollWidth, document.body.scrollWidth);
|
35
|
-
var height =
|
36
|
-
Math.max(documentElement.scrollHeight, document.body.scrollHeight);
|
37
|
-
canvas.width = width;
|
38
|
-
canvas.height = height;
|
39
|
-
var context = canvas.getContext('2d');
|
40
|
-
context.drawWindow(window, 0, 0, width, height, 'rgb(255,255,255)');
|
41
|
-
return canvas;
|
42
|
-
};
|
43
|
-
|
44
|
-
|
45
|
-
Screenshooter.toBase64 = function(canvas) {
|
46
|
-
var dataUrl = canvas.toDataURL('image/png');
|
47
|
-
var index = dataUrl.indexOf('base64,');
|
48
|
-
if (index == -1) {
|
49
|
-
// No base64 data marker.
|
50
|
-
throw new Error("Invalid base64 data: " + dataUrl);
|
51
|
-
}
|
52
|
-
return dataUrl.substring(index + 'base64,'.length);
|
53
|
-
};
|
54
|
-
|
55
|
-
|
56
|
-
Screenshooter.save = function(canvas, filepath) {
|
57
|
-
var cc = Components.classes;
|
58
|
-
var ci = Components.interfaces;
|
59
|
-
var dataUrl = canvas.toDataURL('image/png');
|
60
|
-
var ioService = cc['@mozilla.org/network/io-service;1'].
|
61
|
-
getService(ci.nsIIOService);
|
62
|
-
var dataUri = ioService.newURI(dataUrl, 'UTF-8', null);
|
63
|
-
var channel = ioService.newChannelFromURI(dataUri);
|
64
|
-
var file = cc['@mozilla.org/file/local;1'].createInstance(ci.nsILocalFile);
|
65
|
-
file.initWithPath(filepath);
|
66
|
-
var inputStream = channel.open();
|
67
|
-
var binaryInputStream = cc['@mozilla.org/binaryinputstream;1'].
|
68
|
-
createInstance(ci.nsIBinaryInputStream);
|
69
|
-
binaryInputStream.setInputStream(inputStream);
|
70
|
-
var fileOutputStream = cc['@mozilla.org/network/safe-file-output-stream;1'].
|
71
|
-
createInstance(ci.nsIFileOutputStream);
|
72
|
-
fileOutputStream.init(file, -1, -1, null);
|
73
|
-
var n = binaryInputStream.available();
|
74
|
-
var bytes = binaryInputStream.readBytes(n);
|
75
|
-
fileOutputStream.write(bytes, n);
|
76
|
-
if (fileOutputStream instanceof ci.nsISafeOutputStream) {
|
77
|
-
fileOutputStream.finish();
|
78
|
-
} else {
|
79
|
-
fileOutputStream.close();
|
80
|
-
}
|
81
|
-
};
|
@@ -1,314 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Copyright 2007-2010 WebDriver committers
|
3
|
-
Copyright 2007-2010 Google Inc.
|
4
|
-
Portions copyright 2007 ThoughtWorks, Inc
|
5
|
-
|
6
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
you may not use this file except in compliance with the License.
|
8
|
-
You may obtain a copy of the License at
|
9
|
-
|
10
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
|
12
|
-
Unless required by applicable law or agreed to in writing, software
|
13
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
See the License for the specific language governing permissions and
|
16
|
-
limitations under the License.
|
17
|
-
*/
|
18
|
-
|
19
|
-
/**
|
20
|
-
* Logs a message to the console service.
|
21
|
-
* @param {string} message The message to log.
|
22
|
-
*/
|
23
|
-
function log(message) {
|
24
|
-
Components.classes['@mozilla.org/consoleservice;1'].
|
25
|
-
getService(Components.interfaces.nsIConsoleService).
|
26
|
-
logStringMessage(message);
|
27
|
-
}
|
28
|
-
|
29
|
-
|
30
|
-
/**
|
31
|
-
* An active FirefoxDriver session.
|
32
|
-
* @constructor
|
33
|
-
*/
|
34
|
-
function wdSession() {
|
35
|
-
/**
|
36
|
-
* A wrapped self-reference for XPConnect.
|
37
|
-
* @type {wdSession}
|
38
|
-
*/
|
39
|
-
this.wrappedJSObject = this;
|
40
|
-
}
|
41
|
-
|
42
|
-
|
43
|
-
/**
|
44
|
-
* This component's ID.
|
45
|
-
* @type {nsIJSID}
|
46
|
-
*/
|
47
|
-
wdSession.CLASS_ID = Components.ID('{e193dc71-5b1d-4fea-b4c2-ec71f4557f0f}');
|
48
|
-
|
49
|
-
|
50
|
-
/**
|
51
|
-
* This component's class name.
|
52
|
-
* @type {string}
|
53
|
-
*/
|
54
|
-
wdSession.CLASS_NAME = 'wdSession';
|
55
|
-
|
56
|
-
|
57
|
-
/**
|
58
|
-
* This component's contract ID.
|
59
|
-
* @type {string}
|
60
|
-
*/
|
61
|
-
wdSession.CONTRACT_ID = '@googlecode.com/webdriver/wdsession;1';
|
62
|
-
|
63
|
-
|
64
|
-
/**
|
65
|
-
* This session's ID.
|
66
|
-
* @type {?string}
|
67
|
-
* @private
|
68
|
-
*/
|
69
|
-
wdSession.prototype.id_ = null;
|
70
|
-
|
71
|
-
|
72
|
-
/**
|
73
|
-
* The main chrome window that this is session is currently focused on. All
|
74
|
-
* command's for this session will be directed at the current window, which
|
75
|
-
* may be inside a [I]FRAME, within this window.
|
76
|
-
* @type {?ChromeWindow}
|
77
|
-
* @private
|
78
|
-
*/
|
79
|
-
wdSession.prototype.chromeWindow_ = null;
|
80
|
-
|
81
|
-
|
82
|
-
/**
|
83
|
-
* The content window this session is currently focused on.
|
84
|
-
* @type {?nsIDOMWindow}
|
85
|
-
* @private
|
86
|
-
*/
|
87
|
-
wdSession.prototype.window_ = null;
|
88
|
-
|
89
|
-
|
90
|
-
/**
|
91
|
-
* The current user input speed setting for this session.
|
92
|
-
* @type {number}
|
93
|
-
* @private
|
94
|
-
*/
|
95
|
-
wdSession.prototype.inputSpeed_ = 1;
|
96
|
-
|
97
|
-
|
98
|
-
/**
|
99
|
-
* The amount of time, in milliseconds, this session should wait for an element
|
100
|
-
* to be located when performing a search.
|
101
|
-
* When searching for a single element, the driver will wait up to this amount
|
102
|
-
* of time for the element to be located before returning an error.
|
103
|
-
* When searching for multiple elements, the driver will wait up to this amount
|
104
|
-
* of time for at least one element to be located before returning an empty
|
105
|
-
* list.
|
106
|
-
* @type {number}
|
107
|
-
* @private
|
108
|
-
*/
|
109
|
-
wdSession.prototype.implicitWait_ = 0;
|
110
|
-
|
111
|
-
|
112
|
-
/** @see nsISupports.QueryInterface */
|
113
|
-
wdSession.prototype.QueryInterface = function(aIID) {
|
114
|
-
if (aIID.equals(Components.interfaces.nsISupports)) {
|
115
|
-
return this;
|
116
|
-
}
|
117
|
-
throw Components.results.NS_ERROR_NO_INTERFACE;
|
118
|
-
};
|
119
|
-
|
120
|
-
|
121
|
-
/** @return {?string} This session's ID. */
|
122
|
-
wdSession.prototype.getId = function() {
|
123
|
-
return this.id_;
|
124
|
-
};
|
125
|
-
|
126
|
-
|
127
|
-
/**
|
128
|
-
* Sets this session's ID.
|
129
|
-
* @param {string} id The session ID.
|
130
|
-
*/
|
131
|
-
wdSession.prototype.setId = function(id) {
|
132
|
-
this.id_ = id;
|
133
|
-
};
|
134
|
-
|
135
|
-
|
136
|
-
/**
|
137
|
-
* @return {browser|tabbrowser} The browser object for this session's current
|
138
|
-
* window.
|
139
|
-
*/
|
140
|
-
wdSession.prototype.getBrowser = function() {
|
141
|
-
return this.chromeWindow_.getBrowser();
|
142
|
-
};
|
143
|
-
|
144
|
-
|
145
|
-
/** @return {?ChromeWindow} The chrome window for this session. */
|
146
|
-
wdSession.prototype.getChromeWindow = function() {
|
147
|
-
return this.chromeWindow_;
|
148
|
-
};
|
149
|
-
|
150
|
-
|
151
|
-
/** @return {?nsIDOMWindow} This session's current window. */
|
152
|
-
wdSession.prototype.getWindow = function() {
|
153
|
-
if (!this.window_.document) {
|
154
|
-
// Uh-oh, we lost our DOM! Try to recover by changing focus to the
|
155
|
-
// main content window.
|
156
|
-
this.setWindow(this.chromeWindow_.getBrowser().contentWindow);
|
157
|
-
}
|
158
|
-
return this.window_;
|
159
|
-
};
|
160
|
-
|
161
|
-
|
162
|
-
/** @return {nsIDOMDocument} This session's current document. */
|
163
|
-
wdSession.prototype.getDocument = function() {
|
164
|
-
return this.getWindow().document;
|
165
|
-
return this.window_.document;
|
166
|
-
};
|
167
|
-
|
168
|
-
|
169
|
-
/**
|
170
|
-
* Set the chrome window for this session; will also set the current window to
|
171
|
-
* the main content window inside the chrome window.
|
172
|
-
* @param {ChromeWindow} win The new chrome window.
|
173
|
-
*/
|
174
|
-
wdSession.prototype.setChromeWindow = function(win) {
|
175
|
-
this.chromeWindow_ = win;
|
176
|
-
this.setWindow(win.getBrowser().contentWindow);
|
177
|
-
};
|
178
|
-
|
179
|
-
|
180
|
-
/**
|
181
|
-
* Set this session's current window. If the selected window is a frameset,
|
182
|
-
* the current window will be adjusted to focus on the first frame.
|
183
|
-
* @param {nsIDOMWindow} win The new window.
|
184
|
-
*/
|
185
|
-
wdSession.prototype.setWindow = function(win) {
|
186
|
-
this.window_ = win;
|
187
|
-
var frames = this.window_.frames;
|
188
|
-
if (frames && frames.length && 'FRAME' == frames[0].frameElement.tagName) {
|
189
|
-
this.window_ = frames[0];
|
190
|
-
}
|
191
|
-
};
|
192
|
-
|
193
|
-
|
194
|
-
/**
|
195
|
-
* @return {number} The user input speed for this session.
|
196
|
-
*/
|
197
|
-
wdSession.prototype.getInputSpeed = function() {
|
198
|
-
return this.inputSpeed_;
|
199
|
-
};
|
200
|
-
|
201
|
-
|
202
|
-
/**
|
203
|
-
* Sets the user input speed for this session.
|
204
|
-
* @param {number} speed The new input speed.
|
205
|
-
*/
|
206
|
-
wdSession.prototype.setInputSpeed = function(speed) {
|
207
|
-
this.inputSpeed_ = speed;
|
208
|
-
};
|
209
|
-
|
210
|
-
|
211
|
-
/**
|
212
|
-
* @return {number} The amount of time, in milliseconds, this session should
|
213
|
-
* wait for an element to be located on the page.
|
214
|
-
*/
|
215
|
-
wdSession.prototype.getImplicitWait = function() {
|
216
|
-
return this.implicitWait_;
|
217
|
-
};
|
218
|
-
|
219
|
-
|
220
|
-
/**
|
221
|
-
* Sets the amount of time, in milliseconds, this session should wait for an
|
222
|
-
* element to be located on the page.
|
223
|
-
* @param {number} wait The amount of time to wait.
|
224
|
-
*/
|
225
|
-
wdSession.prototype.setImplicitWait = function(wait) {
|
226
|
-
this.implicitWait_ = Math.max(wait, 0);
|
227
|
-
};
|
228
|
-
|
229
|
-
|
230
|
-
///////////////////////////////////////////////////////////////////
|
231
|
-
//
|
232
|
-
// nsIFactory functions
|
233
|
-
//
|
234
|
-
///////////////////////////////////////////////////////////////////
|
235
|
-
|
236
|
-
/** @constructor */
|
237
|
-
function wdSessionFactory() {
|
238
|
-
}
|
239
|
-
|
240
|
-
|
241
|
-
/** @see nsIFactory.createInstance */
|
242
|
-
wdSessionFactory.prototype.createInstance = function(aOuter, aIID) {
|
243
|
-
if (aOuter != null) {
|
244
|
-
throw Components.results.NS_ERROR_NO_AGGREGATION;
|
245
|
-
}
|
246
|
-
return new wdSession().QueryInterface(aIID);
|
247
|
-
};
|
248
|
-
|
249
|
-
///////////////////////////////////////////////////////////////////
|
250
|
-
//
|
251
|
-
// nsIModule functions
|
252
|
-
//
|
253
|
-
///////////////////////////////////////////////////////////////////
|
254
|
-
|
255
|
-
/** @constructor */
|
256
|
-
function wdSessionModule() {
|
257
|
-
}
|
258
|
-
|
259
|
-
|
260
|
-
/**
|
261
|
-
* Whether this module has already been registered.
|
262
|
-
* @type {!boolean}
|
263
|
-
* @private
|
264
|
-
*/
|
265
|
-
wdSessionModule.prototype.hasRegistered_ = false;
|
266
|
-
|
267
|
-
|
268
|
-
/** @see nsIModule.registerSelf */
|
269
|
-
wdSessionModule.prototype.registerSelf = function(aCompMgr, aFileSpec, aLocation, aType) {
|
270
|
-
if (this.hasRegistered_) {
|
271
|
-
throw Components.results.NS_ERROR_FACTORY_REGISTER_AGAIN;
|
272
|
-
}
|
273
|
-
aCompMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar).
|
274
|
-
registerFactoryLocation(
|
275
|
-
wdSession.CLASS_ID,
|
276
|
-
wdSession.CLASS_NAME,
|
277
|
-
wdSession.CONTRACT_ID,
|
278
|
-
aFileSpec, aLocation, aType);
|
279
|
-
this.hasRegistered_ = true;
|
280
|
-
};
|
281
|
-
|
282
|
-
|
283
|
-
/** @see nsIModule.unregisterSelf */
|
284
|
-
wdSessionModule.prototype.unregisterSelf = function(aCompMgr, aLocation) {
|
285
|
-
aCompMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar).
|
286
|
-
unregisterFactoryLocation(wdSession.CLASS_ID, aLocation);
|
287
|
-
};
|
288
|
-
|
289
|
-
|
290
|
-
/** @see nsIModule.getClassObject */
|
291
|
-
wdSessionModule.prototype.getClassObject = function(aCompMgr, aCID, aIID) {
|
292
|
-
if (!aIID.equals(Components.interfaces.nsIFactory)) {
|
293
|
-
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
294
|
-
} else if (!aCID.equals(wdSession.CLASS_ID)) {
|
295
|
-
throw Components.results.NS_ERROR_NO_INTERFACE;
|
296
|
-
}
|
297
|
-
return new wdSessionFactory();
|
298
|
-
};
|
299
|
-
|
300
|
-
|
301
|
-
/** @see nsIModule.canUnload */
|
302
|
-
wdSessionModule.prototype.canUnload = function() {
|
303
|
-
return true;
|
304
|
-
};
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
/**
|
309
|
-
* Module initialization.
|
310
|
-
*/
|
311
|
-
function NSGetModule() {
|
312
|
-
return new wdSessionModule();
|
313
|
-
}
|
314
|
-
|
@@ -1,226 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Copyright 2007-2010 WebDriver committers
|
3
|
-
Copyright 2007-2010 Google Inc.
|
4
|
-
Portions copyright 2007 ThoughtWorks, Inc
|
5
|
-
|
6
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
you may not use this file except in compliance with the License.
|
8
|
-
You may obtain a copy of the License at
|
9
|
-
|
10
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
|
12
|
-
Unless required by applicable law or agreed to in writing, software
|
13
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
See the License for the specific language governing permissions and
|
16
|
-
limitations under the License.
|
17
|
-
*/
|
18
|
-
|
19
|
-
/**
|
20
|
-
* Logs a message to the console service.
|
21
|
-
* @param {string} message The message to log.
|
22
|
-
*/
|
23
|
-
function log(message) {
|
24
|
-
Components.classes['@mozilla.org/consoleservice;1'].
|
25
|
-
getService(Components.interfaces.nsIConsoleService).
|
26
|
-
logStringMessage(message);
|
27
|
-
}
|
28
|
-
|
29
|
-
|
30
|
-
/**
|
31
|
-
* Service that keeps track of all the active FirefoxDriver sessions.
|
32
|
-
* @constructor
|
33
|
-
*/
|
34
|
-
function wdSessionStoreService() {
|
35
|
-
|
36
|
-
/**
|
37
|
-
* A wrapped self-reference for XPConnect.
|
38
|
-
* @type {wdSessionStoreService}
|
39
|
-
*/
|
40
|
-
this.wrappedJSObject = this;
|
41
|
-
|
42
|
-
/**
|
43
|
-
* Map of active sessions.
|
44
|
-
* @type {Object}
|
45
|
-
* @private
|
46
|
-
*/
|
47
|
-
this.sessions_ = {};
|
48
|
-
}
|
49
|
-
|
50
|
-
|
51
|
-
/**
|
52
|
-
* This component's ID.
|
53
|
-
* @type {nsIJSID}
|
54
|
-
*/
|
55
|
-
wdSessionStoreService.CLASS_ID = Components.ID('{b54195d3-841e-47df-b709-edf1bc4c7166}');
|
56
|
-
|
57
|
-
|
58
|
-
/**
|
59
|
-
* This component's class name.
|
60
|
-
* @type {string}
|
61
|
-
*/
|
62
|
-
wdSessionStoreService.CLASS_NAME = 'wdSessionStoreService';
|
63
|
-
|
64
|
-
|
65
|
-
/**
|
66
|
-
* This component's contract ID.
|
67
|
-
* @type {string}
|
68
|
-
*/
|
69
|
-
wdSessionStoreService.CONTRACT_ID = '@googlecode.com/webdriver/wdsessionstoreservice;1';
|
70
|
-
|
71
|
-
|
72
|
-
/** @see nsISupports.QueryInterface */
|
73
|
-
wdSessionStoreService.prototype.QueryInterface = function(aIID) {
|
74
|
-
if (aIID.equals(Components.interfaces.nsISupports)) {
|
75
|
-
return this;
|
76
|
-
}
|
77
|
-
throw Components.results.NS_ERROR_NO_INTERFACE;
|
78
|
-
};
|
79
|
-
|
80
|
-
|
81
|
-
/**
|
82
|
-
* @return {wdSession} A new WebDriver session.
|
83
|
-
*/
|
84
|
-
wdSessionStoreService.prototype.createSession = function() {
|
85
|
-
var id = Components.classes['@mozilla.org/uuid-generator;1'].
|
86
|
-
getService(Components.interfaces.nsIUUIDGenerator).
|
87
|
-
generateUUID().
|
88
|
-
toString();
|
89
|
-
id = id.substring(1, id.length - 1); // Remove enclosing {} characters
|
90
|
-
|
91
|
-
var session = Components.classes['@googlecode.com/webdriver/wdsession;1'].
|
92
|
-
createInstance(Components.interfaces.nsISupports);
|
93
|
-
|
94
|
-
// Ah, xpconnect...
|
95
|
-
session.wrappedJSObject.setId(id);
|
96
|
-
this.sessions_[id] = session;
|
97
|
-
return session;
|
98
|
-
};
|
99
|
-
|
100
|
-
|
101
|
-
/**
|
102
|
-
* Deletes the specified session.
|
103
|
-
* @param {string} sessionId ID of the session to delete.
|
104
|
-
*/
|
105
|
-
wdSessionStoreService.prototype.deleteSession = function(sessionId) {
|
106
|
-
if (sessionId in this.sessions_) {
|
107
|
-
delete this.sessions_[sessionId];
|
108
|
-
}
|
109
|
-
};
|
110
|
-
|
111
|
-
|
112
|
-
/**
|
113
|
-
* Retrieves the session with the given ID.
|
114
|
-
* @param {string} sessionId ID of the session to retrieve.
|
115
|
-
* @return {wdSession} The matching session.
|
116
|
-
* @throws NS_ERROR_NOT_AVAILABLE if the session does not exist.
|
117
|
-
*/
|
118
|
-
wdSessionStoreService.prototype.getSession = function(sessionId) {
|
119
|
-
if (sessionId in this.sessions_) {
|
120
|
-
var session = this.sessions_[sessionId].wrappedJSObject; // XPConnect
|
121
|
-
return this.sessions_[sessionId];
|
122
|
-
}
|
123
|
-
var sessions = [];
|
124
|
-
for (var session in this.sessions_) {
|
125
|
-
sessions.push(session);
|
126
|
-
}
|
127
|
-
throw Components.results.NS_ERROR_NOT_AVAILABLE;
|
128
|
-
};
|
129
|
-
|
130
|
-
|
131
|
-
///////////////////////////////////////////////////////////////////
|
132
|
-
//
|
133
|
-
// nsIFactory functions
|
134
|
-
//
|
135
|
-
///////////////////////////////////////////////////////////////////
|
136
|
-
|
137
|
-
/** @constructor */
|
138
|
-
function wdSessionStoreServiceFactory() {
|
139
|
-
}
|
140
|
-
|
141
|
-
|
142
|
-
/**
|
143
|
-
* The singleton instance for this component.
|
144
|
-
* @type {?wdSessionStoreService}
|
145
|
-
* @private
|
146
|
-
*/
|
147
|
-
wdSessionStoreServiceFactory.prototype.instance_ = null;
|
148
|
-
|
149
|
-
|
150
|
-
/** @see nsIFactory.createInstance */
|
151
|
-
wdSessionStoreServiceFactory.prototype.createInstance = function(aOuter, aIID) {
|
152
|
-
if (aOuter != null) {
|
153
|
-
throw Components.results.NS_ERROR_NO_AGGREGATION;
|
154
|
-
}
|
155
|
-
if (!this.instance_) {
|
156
|
-
this.instance_ = new wdSessionStoreService();
|
157
|
-
}
|
158
|
-
return this.instance_.QueryInterface(aIID);
|
159
|
-
};
|
160
|
-
|
161
|
-
///////////////////////////////////////////////////////////////////
|
162
|
-
//
|
163
|
-
// nsIModule functions
|
164
|
-
//
|
165
|
-
///////////////////////////////////////////////////////////////////
|
166
|
-
|
167
|
-
/** @constructor */
|
168
|
-
function wdSessionStoreServiceModule() {
|
169
|
-
}
|
170
|
-
|
171
|
-
|
172
|
-
/**
|
173
|
-
* Whether this module has already been registered.
|
174
|
-
* @type {!boolean}
|
175
|
-
* @private
|
176
|
-
*/
|
177
|
-
wdSessionStoreServiceModule.prototype.hasRegistered_ = false;
|
178
|
-
|
179
|
-
|
180
|
-
/** @see nsIModule.registerSelf */
|
181
|
-
wdSessionStoreServiceModule.prototype.registerSelf = function(aCompMgr, aFileSpec, aLocation, aType) {
|
182
|
-
if (this.hasRegistered_) {
|
183
|
-
throw Components.results.NS_ERROR_FACTORY_REGISTER_AGAIN;
|
184
|
-
}
|
185
|
-
aCompMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar).
|
186
|
-
registerFactoryLocation(
|
187
|
-
wdSessionStoreService.CLASS_ID,
|
188
|
-
wdSessionStoreService.CLASS_NAME,
|
189
|
-
wdSessionStoreService.CONTRACT_ID,
|
190
|
-
aFileSpec, aLocation, aType);
|
191
|
-
this.hasRegistered_ = true;
|
192
|
-
};
|
193
|
-
|
194
|
-
|
195
|
-
/** @see nsIModule.unregisterSelf */
|
196
|
-
wdSessionStoreServiceModule.prototype.unregisterSelf = function(aCompMgr, aLocation) {
|
197
|
-
aCompMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar).
|
198
|
-
unregisterFactoryLocation(wdSessionStoreService.CLASS_ID, aLocation);
|
199
|
-
};
|
200
|
-
|
201
|
-
|
202
|
-
/** @see nsIModule.getClassObject */
|
203
|
-
wdSessionStoreServiceModule.prototype.getClassObject = function(aCompMgr, aCID, aIID) {
|
204
|
-
if (!aIID.equals(Components.interfaces.nsIFactory)) {
|
205
|
-
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
206
|
-
} else if (!aCID.equals(wdSessionStoreService.CLASS_ID)) {
|
207
|
-
throw Components.results.NS_ERROR_NO_INTERFACE;
|
208
|
-
}
|
209
|
-
return new wdSessionStoreServiceFactory();
|
210
|
-
};
|
211
|
-
|
212
|
-
|
213
|
-
/** @see nsIModule.canUnload */
|
214
|
-
wdSessionStoreServiceModule.prototype.canUnload = function() {
|
215
|
-
return true;
|
216
|
-
};
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
/**
|
221
|
-
* Module initialization.
|
222
|
-
*/
|
223
|
-
function NSGetModule() {
|
224
|
-
return new wdSessionStoreServiceModule();
|
225
|
-
}
|
226
|
-
|