selenium-webdriver 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/chrome/prebuilt/Win32/Release/npchromedriver.dll +0 -0
- data/chrome/prebuilt/x64/Release/npchromedriver.dll +0 -0
- data/chrome/src/extension/background.js +1 -0
- data/chrome/src/extension/content_script.js +182 -177
- data/chrome/src/extension/manifest-nonwin.json +1 -1
- data/chrome/src/extension/manifest-win.json +1 -1
- data/chrome/src/rb/lib/selenium/webdriver/chrome/bridge.rb +9 -3
- data/chrome/src/rb/lib/selenium/webdriver/chrome/launcher.rb +1 -1
- data/common/src/js/core/Blank.html +7 -0
- data/common/src/js/core/InjectedRemoteRunner.html +8 -0
- data/common/src/js/core/RemoteRunner.html +101 -0
- data/common/src/js/core/SeleniumLog.html +109 -0
- data/common/src/js/core/TestPrompt.html +145 -0
- data/common/src/js/core/TestRunner-splash.html +55 -0
- data/common/src/js/core/TestRunner.html +177 -0
- 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 +6 -0
- data/common/src/js/core/lib/cssQuery/src/cssQuery-level2.js +142 -0
- data/common/src/js/core/lib/cssQuery/src/cssQuery-level3.js +150 -0
- data/common/src/js/core/lib/cssQuery/src/cssQuery-standard.js +53 -0
- data/common/src/js/core/lib/cssQuery/src/cssQuery.js +356 -0
- data/common/src/js/core/lib/prototype.js +2006 -0
- data/common/src/js/core/lib/scriptaculous/builder.js +101 -0
- data/common/src/js/core/lib/scriptaculous/controls.js +815 -0
- data/common/src/js/core/lib/scriptaculous/dragdrop.js +915 -0
- data/common/src/js/core/lib/scriptaculous/effects.js +958 -0
- data/common/src/js/core/lib/scriptaculous/scriptaculous.js +47 -0
- data/common/src/js/core/lib/scriptaculous/slider.js +283 -0
- data/common/src/js/core/lib/scriptaculous/unittest.js +383 -0
- data/common/src/js/core/lib/snapsie.js +91 -0
- data/common/src/js/core/scripts/find_matching_child.js +69 -0
- data/common/src/js/core/scripts/htmlutils.js +1623 -0
- data/common/src/js/core/scripts/injection.html +72 -0
- data/common/src/js/core/scripts/selenium-api.js +3294 -0
- data/common/src/js/core/scripts/selenium-browserbot.js +2430 -0
- data/common/src/js/core/scripts/selenium-browserdetect.js +153 -0
- data/common/src/js/core/scripts/selenium-commandhandlers.js +379 -0
- data/common/src/js/core/scripts/selenium-executionloop.js +175 -0
- data/common/src/js/core/scripts/selenium-logging.js +148 -0
- data/common/src/js/core/scripts/selenium-remoterunner.js +695 -0
- data/common/src/js/core/scripts/selenium-testrunner.js +1362 -0
- data/common/src/js/core/scripts/selenium-version.js +5 -0
- data/common/src/js/core/scripts/ui-doc.html +808 -0
- data/common/src/js/core/scripts/ui-element.js +1644 -0
- data/common/src/js/core/scripts/ui-map-sample.js +979 -0
- data/common/src/js/core/scripts/user-extensions.js +3 -0
- data/common/src/js/core/scripts/user-extensions.js.sample +75 -0
- data/common/src/js/core/scripts/xmlextras.js +153 -0
- data/common/src/js/core/selenium-logo.png +0 -0
- data/common/src/js/core/selenium-test.css +43 -0
- data/common/src/js/core/selenium.css +316 -0
- data/common/src/js/core/xpath/dom.js +566 -0
- data/common/src/js/core/xpath/javascript-xpath-0.1.11.js +2816 -0
- data/common/src/js/core/xpath/util.js +549 -0
- data/common/src/js/core/xpath/xmltoken.js +149 -0
- data/common/src/js/core/xpath/xpath.js +2481 -0
- data/common/src/js/jsunit/app/css/jsUnitStyle.css +50 -0
- data/common/src/js/jsunit/app/css/readme +10 -0
- data/common/src/js/jsunit/app/emptyPage.html +11 -0
- data/common/src/js/jsunit/app/jsUnitCore.js +534 -0
- data/common/src/js/jsunit/app/jsUnitMockTimeout.js +81 -0
- data/common/src/js/jsunit/app/jsUnitTestManager.js +705 -0
- data/common/src/js/jsunit/app/jsUnitTestSuite.js +44 -0
- data/common/src/js/jsunit/app/jsUnitTracer.js +102 -0
- data/common/src/js/jsunit/app/jsUnitVersionCheck.js +59 -0
- data/common/src/js/jsunit/app/main-counts-errors.html +12 -0
- data/common/src/js/jsunit/app/main-counts-failures.html +13 -0
- data/common/src/js/jsunit/app/main-counts-runs.html +13 -0
- data/common/src/js/jsunit/app/main-counts.html +21 -0
- data/common/src/js/jsunit/app/main-data.html +178 -0
- data/common/src/js/jsunit/app/main-errors.html +23 -0
- data/common/src/js/jsunit/app/main-frame.html +19 -0
- data/common/src/js/jsunit/app/main-loader.html +45 -0
- data/common/src/js/jsunit/app/main-progress.html +25 -0
- data/common/src/js/jsunit/app/main-results.html +67 -0
- data/common/src/js/jsunit/app/main-status.html +13 -0
- data/common/src/js/jsunit/app/testContainer.html +16 -0
- data/common/src/js/jsunit/app/testContainerController.html +77 -0
- data/common/src/js/jsunit/app/xbDebug.js +306 -0
- data/common/src/js/jsunit/changelog.txt +60 -0
- data/common/src/js/jsunit/css/jsUnitStyle.css +83 -0
- 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 +56 -0
- data/common/src/js/jsunit/licenses/Jetty_license.html +213 -0
- data/common/src/js/jsunit/licenses/MPL-1.1.txt +470 -0
- data/common/src/js/jsunit/licenses/gpl-2.txt +340 -0
- data/common/src/js/jsunit/licenses/index.html +141 -0
- data/common/src/js/jsunit/licenses/lgpl-2.1.txt +504 -0
- data/common/src/js/jsunit/licenses/mpl-tri-license-c.txt +35 -0
- data/common/src/js/jsunit/licenses/mpl-tri-license-html.txt +35 -0
- data/common/src/js/jsunit/readme.txt +19 -0
- data/common/src/js/jsunit/testRunner.html +167 -0
- data/common/src/js/jsunit/version.txt +1 -0
- data/common/src/rb/README +29 -0
- data/common/src/rb/lib/selenium/webdriver/driver.rb +124 -12
- data/common/src/rb/lib/selenium/webdriver/element.rb +119 -3
- data/common/src/rb/lib/selenium/webdriver/error.rb +1 -2
- data/common/src/rb/lib/selenium/webdriver/find.rb +19 -2
- data/common/src/rb/lib/selenium/webdriver/keys.rb +5 -1
- data/common/src/rb/lib/selenium/webdriver/navigation.rb +8 -4
- data/common/src/rb/lib/selenium/webdriver/platform.rb +4 -2
- data/common/src/rb/lib/selenium/webdriver/target_locator.rb +18 -0
- data/firefox/prebuilt/Win32/Release/webdriver-firefox.dll +0 -0
- data/firefox/prebuilt/linux/Release/libwebdriver-firefox.so +0 -0
- data/firefox/prebuilt/linux/Release/x_ignore_nofocus.so +0 -0
- data/firefox/prebuilt/linux64/Release/libwebdriver-firefox.so +0 -0
- data/firefox/prebuilt/linux64/Release/x_ignore_nofocus.so +0 -0
- data/firefox/src/extension/components/utils.js +13 -2
- data/firefox/src/extension/install.rdf +1 -1
- data/firefox/src/rb/lib/selenium/webdriver/firefox.rb +3 -2
- data/firefox/src/rb/lib/selenium/webdriver/firefox/binary.rb +1 -7
- data/firefox/src/rb/lib/selenium/webdriver/firefox/bridge.rb +11 -4
- data/firefox/src/rb/lib/selenium/webdriver/firefox/profile.rb +56 -15
- data/firefox/src/rb/lib/selenium/webdriver/firefox/util.rb +1 -1
- data/jobbie/prebuilt/Win32/Release/InternetExplorerDriver.dll +0 -0
- data/jobbie/prebuilt/x64/Release/InternetExplorerDriver.dll +0 -0
- data/jobbie/src/rb/lib/selenium/webdriver/ie/bridge.rb +10 -5
- data/jobbie/src/rb/lib/selenium/webdriver/ie/util.rb +9 -10
- data/remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb +4 -2
- data/remote/client/src/rb/lib/selenium/webdriver/remote/capabilities.rb +23 -23
- metadata +103 -6
- data/jobbie/prebuilt/Win32/Release/webdriver-ie-test.dll +0 -0
- data/jobbie/prebuilt/Win32/Release/webdriver-ie.dll +0 -0
- data/jobbie/prebuilt/x64/Release/webdriver-ie-test.dll +0 -0
- data/jobbie/prebuilt/x64/Release/webdriver-ie.dll +0 -0
@@ -0,0 +1,35 @@
|
|
1
|
+
/* ***** BEGIN LICENSE BLOCK *****
|
2
|
+
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
3
|
+
*
|
4
|
+
* The contents of this file are subject to the Mozilla Public License Version
|
5
|
+
* 1.1 (the "License"); you may not use this file except in compliance with
|
6
|
+
* the License. You may obtain a copy of the License at
|
7
|
+
* http://www.mozilla.org/MPL/
|
8
|
+
*
|
9
|
+
* Software distributed under the License is distributed on an "AS IS" basis,
|
10
|
+
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
11
|
+
* for the specific language governing rights and limitations under the
|
12
|
+
* License.
|
13
|
+
*
|
14
|
+
* The Original Code is __________________________________________.
|
15
|
+
*
|
16
|
+
* The Initial Developer of the Original Code is
|
17
|
+
* ____________________________________________.
|
18
|
+
* Portions created by the Initial Developer are Copyright (C) 2___
|
19
|
+
* the Initial Developer. All Rights Reserved.
|
20
|
+
*
|
21
|
+
* Contributor(s):
|
22
|
+
*
|
23
|
+
* Alternatively, the contents of this file may be used under the terms of
|
24
|
+
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
25
|
+
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
26
|
+
* in which case the provisions of the GPL or the LGPL are applicable instead
|
27
|
+
* of those above. If you wish to allow use of your version of this file only
|
28
|
+
* under the terms of either the GPL or the LGPL, and not to allow others to
|
29
|
+
* use your version of this file under the terms of the MPL, indicate your
|
30
|
+
* decision by deleting the provisions above and replace them with the notice
|
31
|
+
* and other provisions required by the GPL or the LGPL. If you do not delete
|
32
|
+
* the provisions above, a recipient may use your version of this file under
|
33
|
+
* the terms of any one of the MPL, the GPL or the LGPL.
|
34
|
+
*
|
35
|
+
* ***** END LICENSE BLOCK ***** */
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<!-- ***** BEGIN LICENSE BLOCK *****
|
2
|
+
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
3
|
+
-
|
4
|
+
- The contents of this file are subject to the Mozilla Public License Version
|
5
|
+
- 1.1 (the "License"); you may not use this file except in compliance with
|
6
|
+
- the License. You may obtain a copy of the License at
|
7
|
+
- http://www.mozilla.org/MPL/
|
8
|
+
-
|
9
|
+
- Software distributed under the License is distributed on an "AS IS" basis,
|
10
|
+
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
11
|
+
- for the specific language governing rights and limitations under the
|
12
|
+
- License.
|
13
|
+
-
|
14
|
+
- The Original Code is __________________________________________.
|
15
|
+
-
|
16
|
+
- The Initial Developer of the Original Code is
|
17
|
+
- ____________________________________________.
|
18
|
+
- Portions created by the Initial Developer are Copyright (C) 2___
|
19
|
+
- the Initial Developer. All Rights Reserved.
|
20
|
+
-
|
21
|
+
- Contributor(s):
|
22
|
+
-
|
23
|
+
- Alternatively, the contents of this file may be used under the terms of
|
24
|
+
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
25
|
+
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
26
|
+
- in which case the provisions of the GPL or the LGPL are applicable instead
|
27
|
+
- of those above. If you wish to allow use of your version of this file only
|
28
|
+
- under the terms of either the GPL or the LGPL, and not to allow others to
|
29
|
+
- use your version of this file under the terms of the MPL, indicate your
|
30
|
+
- decision by deleting the provisions above and replace them with the notice
|
31
|
+
- and other provisions required by the LGPL or the GPL. If you do not delete
|
32
|
+
- the provisions above, a recipient may use your version of this file under
|
33
|
+
- the terms of any one of the MPL, the GPL or the LGPL.
|
34
|
+
-
|
35
|
+
- ***** END LICENSE BLOCK ***** -->
|
@@ -0,0 +1,19 @@
|
|
1
|
+
JsUnit
|
2
|
+
Copyright (C) 2001-6 Edward Hieatt, edward@jsunit.net
|
3
|
+
|
4
|
+
This program is free software; you can redistribute it and/or
|
5
|
+
modify it under the terms of the GNU General Public License
|
6
|
+
as published by the Free Software Foundation; either version 2
|
7
|
+
of the License, or (at your option) any later version.
|
8
|
+
|
9
|
+
This program is distributed in the hope that it will be useful,
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
GNU General Public License for more details.
|
13
|
+
|
14
|
+
You should have received a copy of the GNU General Public License
|
15
|
+
along with this program; if not, write to the Free Software
|
16
|
+
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
17
|
+
|
18
|
+
Please see http://www.jsunit.net/ for JsUnit documentation and
|
19
|
+
the "licenses" directory for license information.
|
@@ -0,0 +1,167 @@
|
|
1
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
|
2
|
+
<html>
|
3
|
+
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
6
|
+
<title>JsUnit Test Runner</title>
|
7
|
+
<script language="JavaScript" type="text/javascript" src="app/xbDebug.js"></script>
|
8
|
+
<script language="JavaScript" type="text/javascript" src="app/jsUnitCore.js"></script>
|
9
|
+
<script language="JavaScript" type="text/javascript">
|
10
|
+
var DEFAULT_TEST_FRAME_HEIGHT = 250;
|
11
|
+
|
12
|
+
function jsUnitParseParms(string) {
|
13
|
+
var i;
|
14
|
+
var searchString = unescape(string);
|
15
|
+
var parameterHash = new Object();
|
16
|
+
|
17
|
+
if (!searchString) {
|
18
|
+
return parameterHash;
|
19
|
+
}
|
20
|
+
|
21
|
+
i = searchString.indexOf('?');
|
22
|
+
if (i != -1) {
|
23
|
+
searchString = searchString.substring(i + 1);
|
24
|
+
}
|
25
|
+
|
26
|
+
var parmList = searchString.split('&');
|
27
|
+
var a;
|
28
|
+
for (i = 0; i < parmList.length; i++) {
|
29
|
+
a = parmList[i].split('=');
|
30
|
+
a[0] = a[0].toLowerCase();
|
31
|
+
if (a.length > 1) {
|
32
|
+
parameterHash[a[0]] = a[1];
|
33
|
+
}
|
34
|
+
else {
|
35
|
+
parameterHash[a[0]] = true;
|
36
|
+
}
|
37
|
+
}
|
38
|
+
return parameterHash;
|
39
|
+
}
|
40
|
+
|
41
|
+
function jsUnitConstructTestParms() {
|
42
|
+
var p;
|
43
|
+
var parms = '';
|
44
|
+
|
45
|
+
for (p in jsUnitParmHash) {
|
46
|
+
var value = jsUnitParmHash[p];
|
47
|
+
|
48
|
+
if (!value ||
|
49
|
+
p == 'testpage' ||
|
50
|
+
p == 'autorun' ||
|
51
|
+
p == 'submitresults' ||
|
52
|
+
p == 'showtestframe' ||
|
53
|
+
p == 'resultid') {
|
54
|
+
continue;
|
55
|
+
}
|
56
|
+
|
57
|
+
if (parms) {
|
58
|
+
parms += '&';
|
59
|
+
}
|
60
|
+
|
61
|
+
parms += p;
|
62
|
+
|
63
|
+
if (typeof(value) != 'boolean') {
|
64
|
+
parms += '=' + value;
|
65
|
+
}
|
66
|
+
}
|
67
|
+
return escape(parms);
|
68
|
+
}
|
69
|
+
|
70
|
+
var jsUnitParmHash = jsUnitParseParms(document.location.search);
|
71
|
+
|
72
|
+
// set to true to turn debugging code on, false to turn it off.
|
73
|
+
xbDEBUG.on = jsUnitGetParm('debug') ? true : false;
|
74
|
+
</script>
|
75
|
+
|
76
|
+
<script language="JavaScript" type="text/javascript" src="app/jsUnitTestManager.js"></script>
|
77
|
+
<script language="JavaScript" type="text/javascript" src="app/jsUnitTracer.js"></script>
|
78
|
+
<script language="JavaScript" type="text/javascript" src="app/jsUnitTestSuite.js"></script>
|
79
|
+
<script language="JavaScript" type="text/javascript">
|
80
|
+
|
81
|
+
var testManager;
|
82
|
+
var utility;
|
83
|
+
var tracer;
|
84
|
+
|
85
|
+
|
86
|
+
if (!Array.prototype.push) {
|
87
|
+
Array.prototype.push = function (anObject) {
|
88
|
+
this[this.length] = anObject;
|
89
|
+
}
|
90
|
+
}
|
91
|
+
|
92
|
+
if (!Array.prototype.pop) {
|
93
|
+
Array.prototype.pop = function () {
|
94
|
+
if (this.length > 0) {
|
95
|
+
delete this[this.length - 1];
|
96
|
+
this.length--;
|
97
|
+
}
|
98
|
+
}
|
99
|
+
}
|
100
|
+
|
101
|
+
function shouldKickOffTestsAutomatically() {
|
102
|
+
return jsUnitGetParm('autorun') == "true";
|
103
|
+
}
|
104
|
+
|
105
|
+
function shouldShowTestFrame() {
|
106
|
+
return jsUnitGetParm('showtestframe');
|
107
|
+
}
|
108
|
+
|
109
|
+
function shouldSubmitResults() {
|
110
|
+
return jsUnitGetParm('submitresults');
|
111
|
+
}
|
112
|
+
|
113
|
+
function getResultId() {
|
114
|
+
if (jsUnitGetParm('resultid'))
|
115
|
+
return jsUnitGetParm('resultid');
|
116
|
+
return "";
|
117
|
+
}
|
118
|
+
|
119
|
+
function submitResults() {
|
120
|
+
window.mainFrame.mainData.document.testRunnerForm.runButton.disabled = true;
|
121
|
+
window.mainFrame.mainResults.populateHeaderFields(getResultId(), navigator.userAgent, JSUNIT_VERSION, testManager.resolveUserEnteredTestFileName());
|
122
|
+
window.mainFrame.mainResults.submitResults();
|
123
|
+
}
|
124
|
+
|
125
|
+
function wasResultUrlSpecified() {
|
126
|
+
return shouldSubmitResults() && jsUnitGetParm('submitresults') != 'true';
|
127
|
+
}
|
128
|
+
|
129
|
+
function getSpecifiedResultUrl() {
|
130
|
+
return jsUnitGetParm('submitresults');
|
131
|
+
}
|
132
|
+
|
133
|
+
function init() {
|
134
|
+
var testRunnerFrameset = document.getElementById('testRunnerFrameset');
|
135
|
+
if (shouldShowTestFrame() && testRunnerFrameset) {
|
136
|
+
var testFrameHeight;
|
137
|
+
if (jsUnitGetParm('showtestframe') == 'true')
|
138
|
+
testFrameHeight = DEFAULT_TEST_FRAME_HEIGHT;
|
139
|
+
else
|
140
|
+
testFrameHeight = jsUnitGetParm('showtestframe');
|
141
|
+
testRunnerFrameset.rows = '*,0,' + testFrameHeight;
|
142
|
+
}
|
143
|
+
testManager = new jsUnitTestManager();
|
144
|
+
tracer = new JsUnitTracer(testManager);
|
145
|
+
if (shouldKickOffTestsAutomatically()) {
|
146
|
+
window.mainFrame.mainData.kickOffTests();
|
147
|
+
}
|
148
|
+
}
|
149
|
+
|
150
|
+
|
151
|
+
</script>
|
152
|
+
</head>
|
153
|
+
|
154
|
+
<frameset id="testRunnerFrameset" rows="*,0,0" border="0" onload="init()">
|
155
|
+
|
156
|
+
<frame frameborder="0" name="mainFrame" src="./app/main-frame.html">
|
157
|
+
<frame frameborder="0" name="documentLoader" src="./app/main-loader.html">
|
158
|
+
<frame frameborder="0" name="testContainer" src="./app/testContainer.html">
|
159
|
+
|
160
|
+
<noframes>
|
161
|
+
<body>
|
162
|
+
<p>Sorry, JsUnit requires support for frames.</p>
|
163
|
+
</body>
|
164
|
+
</noframes>
|
165
|
+
</frameset>
|
166
|
+
|
167
|
+
</html>
|
@@ -0,0 +1 @@
|
|
1
|
+
JsUnit 22.2 alpha 11
|
@@ -0,0 +1,29 @@
|
|
1
|
+
= selenium-webdriver
|
2
|
+
|
3
|
+
This gem provides Ruby bindings for WebDriver and has been tested to work on MRI (1.8.6 through 1.9), JRuby and Rubinius.
|
4
|
+
|
5
|
+
= INSTALL
|
6
|
+
|
7
|
+
gem install selenium-webdriver
|
8
|
+
|
9
|
+
= LINKS
|
10
|
+
|
11
|
+
* http://gemcutter.org/gems/selenium-webdriver
|
12
|
+
* http://code.google.com/p/selenium/wiki/RubyBindings
|
13
|
+
* http://code.google.com/p/selenium/issues/list
|
14
|
+
|
15
|
+
= LICENSE
|
16
|
+
|
17
|
+
Copyright 2009 WebDriver committers
|
18
|
+
|
19
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
20
|
+
you may not use this file except in compliance with the License.
|
21
|
+
You may obtain a copy of the License at
|
22
|
+
|
23
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
24
|
+
|
25
|
+
Unless required by applicable law or agreed to in writing, software
|
26
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
27
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
28
|
+
See the License for the specific language governing permissions and
|
29
|
+
limitations under the License.
|
@@ -1,11 +1,33 @@
|
|
1
1
|
module Selenium
|
2
2
|
module WebDriver
|
3
|
+
|
4
|
+
#
|
5
|
+
# The main class through which you control the browser.
|
6
|
+
#
|
7
|
+
# @see Find
|
8
|
+
# @see Navigation
|
9
|
+
# @see TargetLocator
|
10
|
+
# @see Options
|
11
|
+
#
|
12
|
+
|
3
13
|
class Driver
|
4
14
|
include Find
|
5
15
|
|
6
16
|
attr_reader :bridge
|
7
17
|
|
8
18
|
class << self
|
19
|
+
|
20
|
+
#
|
21
|
+
# Create a new Driver instance with the correct bridge for the given browser
|
22
|
+
#
|
23
|
+
# @param browser [Symbol]
|
24
|
+
# the driver type to use
|
25
|
+
# @param *rest
|
26
|
+
# arguments passed to the Bridge.new
|
27
|
+
#
|
28
|
+
# @return [Driver]
|
29
|
+
#
|
30
|
+
|
9
31
|
def for(browser, *args)
|
10
32
|
bridge = case browser
|
11
33
|
when :ie, :internet_explorer
|
@@ -30,6 +52,12 @@ module Selenium
|
|
30
52
|
end
|
31
53
|
end
|
32
54
|
|
55
|
+
#
|
56
|
+
# A new Driver instance
|
57
|
+
#
|
58
|
+
# @api private
|
59
|
+
#
|
60
|
+
|
33
61
|
def initialize(bridge)
|
34
62
|
@bridge = bridge
|
35
63
|
end
|
@@ -38,54 +66,140 @@ module Selenium
|
|
38
66
|
'#<%s:0x%x browser=%s>' % [self.class, hash*2, bridge.browser.inspect]
|
39
67
|
end
|
40
68
|
|
69
|
+
#
|
70
|
+
# @return [Navigation]
|
71
|
+
# @see Navigation
|
72
|
+
#
|
73
|
+
|
41
74
|
def navigate
|
42
75
|
@navigate ||= WebDriver::Navigation.new(self)
|
43
76
|
end
|
44
77
|
|
78
|
+
#
|
79
|
+
# @return [TargetLocator]
|
80
|
+
# @see TargetLocator
|
81
|
+
#
|
82
|
+
|
45
83
|
def switch_to
|
46
84
|
@switch_to ||= WebDriver::TargetLocator.new(self)
|
47
85
|
end
|
48
86
|
|
87
|
+
#
|
88
|
+
# @return [Options]
|
89
|
+
# @see Options
|
90
|
+
#
|
91
|
+
|
49
92
|
def manage
|
50
93
|
@manage ||= WebDriver::Options.new(self)
|
51
94
|
end
|
52
95
|
|
96
|
+
#
|
97
|
+
# Opens the specified URL in the browser.
|
98
|
+
#
|
99
|
+
|
100
|
+
def get(url)
|
101
|
+
navigate.to(url)
|
102
|
+
end
|
103
|
+
|
104
|
+
#
|
105
|
+
# Get the URL of the current page
|
106
|
+
#
|
107
|
+
# @return [String]
|
108
|
+
#
|
109
|
+
|
53
110
|
def current_url
|
54
111
|
bridge.getCurrentUrl
|
55
112
|
end
|
56
113
|
|
114
|
+
#
|
115
|
+
# Get the title of the current page
|
116
|
+
#
|
117
|
+
# @return [String]
|
118
|
+
#
|
119
|
+
|
57
120
|
def title
|
58
121
|
bridge.getTitle
|
59
122
|
end
|
60
123
|
|
124
|
+
#
|
125
|
+
# Get the source of the current page
|
126
|
+
#
|
127
|
+
# @return [String]
|
128
|
+
#
|
129
|
+
|
61
130
|
def page_source
|
62
131
|
bridge.getPageSource
|
63
132
|
end
|
64
133
|
|
134
|
+
#
|
135
|
+
# Get the visibility of the browser. Not applicable for all browsers.
|
136
|
+
#
|
137
|
+
# @return [Boolean]
|
138
|
+
#
|
139
|
+
|
65
140
|
def visible?
|
66
141
|
bridge.getBrowserVisible
|
67
142
|
end
|
68
143
|
|
144
|
+
#
|
145
|
+
# Set the visibility of the browser. Not applicable for all browsers.
|
146
|
+
#
|
147
|
+
# @param [Boolean]
|
148
|
+
#
|
149
|
+
|
69
150
|
def visible=(bool)
|
70
151
|
bridge.setBrowserVisible bool
|
71
152
|
end
|
72
153
|
|
154
|
+
#
|
155
|
+
# Quit the browser
|
156
|
+
#
|
157
|
+
|
73
158
|
def quit
|
74
159
|
bridge.quit
|
75
160
|
end
|
76
161
|
|
162
|
+
#
|
163
|
+
# Close the current window, or the browser if no windows are left.
|
164
|
+
#
|
165
|
+
|
77
166
|
def close
|
78
167
|
bridge.close
|
79
168
|
end
|
80
169
|
|
170
|
+
#
|
171
|
+
# Get the window handles of open browser windows.
|
172
|
+
#
|
173
|
+
# @return [Array]
|
174
|
+
# @see TargetLocator#window
|
175
|
+
#
|
176
|
+
|
81
177
|
def window_handles
|
82
178
|
bridge.getWindowHandles
|
83
179
|
end
|
84
180
|
|
181
|
+
#
|
182
|
+
# Get the current window handle
|
183
|
+
#
|
184
|
+
# @return [String]
|
185
|
+
#
|
186
|
+
|
85
187
|
def window_handle
|
86
188
|
bridge.getCurrentWindowHandle
|
87
189
|
end
|
88
190
|
|
191
|
+
#
|
192
|
+
# Execute the given JavaScript
|
193
|
+
#
|
194
|
+
# @param [String] script
|
195
|
+
# JavaScript source to execute
|
196
|
+
# @param [WebDriver::Element,Integer, Float, Boolean, NilClass, String, Array] *args
|
197
|
+
# Arguments will be available in the given script as the 'arguments' array.
|
198
|
+
#
|
199
|
+
# @return [WebDriver::Element,Integer,Float,Boolean,NilClass,String,Array]
|
200
|
+
# The value returned from the script.
|
201
|
+
#
|
202
|
+
|
89
203
|
def execute_script(script, *args)
|
90
204
|
bridge.executeScript(script, *args)
|
91
205
|
end
|
@@ -93,33 +207,29 @@ module Selenium
|
|
93
207
|
#-------------------------------- sugar --------------------------------
|
94
208
|
|
95
209
|
#
|
96
|
-
#
|
210
|
+
# driver.first(:id, 'foo')
|
97
211
|
#
|
98
212
|
|
99
213
|
alias_method :first, :find_element
|
100
214
|
|
101
215
|
#
|
102
|
-
#
|
216
|
+
# driver.all(:class, 'bar') #=> [#<WebDriver::Element:0x1011c3b88, ...]
|
103
217
|
#
|
104
218
|
|
105
219
|
alias_method :all, :find_elements
|
106
220
|
|
107
221
|
#
|
108
|
-
#
|
109
|
-
#
|
110
|
-
|
111
|
-
def get(url)
|
112
|
-
navigate.to(url)
|
113
|
-
end
|
114
|
-
|
115
|
-
#
|
116
|
-
# driver.script('function() { ... };')
|
222
|
+
# driver.script('function() { ... };')
|
117
223
|
#
|
118
224
|
|
119
225
|
alias_method :script, :execute_script
|
120
226
|
|
227
|
+
# Get the first element matching the given id.
|
121
228
|
#
|
122
|
-
#
|
229
|
+
# @param [String] id
|
230
|
+
# @return [WebDriver::Element]
|
231
|
+
#
|
232
|
+
# driver['someElementId'] #=> #<WebDriver::Element:0x1011c3b88>
|
123
233
|
#
|
124
234
|
|
125
235
|
def [](id)
|
@@ -130,6 +240,8 @@ module Selenium
|
|
130
240
|
#
|
131
241
|
# for Find
|
132
242
|
#
|
243
|
+
# @api private
|
244
|
+
#
|
133
245
|
|
134
246
|
def ref
|
135
247
|
nil
|