selenium-core-runner 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. data/Gemfile +9 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +3 -0
  4. data/Rakefile +30 -0
  5. data/app/controllers/selenium_core_runner/suites_controller.rb +19 -0
  6. data/app/views/selenium_core_runner/suites/index.html.erb +177 -0
  7. data/app/views/selenium_core_runner/suites/show.html.erb +0 -0
  8. data/config/routes.rb +6 -0
  9. data/lib/selenium-core-runner/engine.rb +19 -0
  10. data/lib/selenium-core-runner.rb +3 -0
  11. data/public/selenium-core-runner/Blank.html +7 -0
  12. data/public/selenium-core-runner/InjectedRemoteRunner.html +8 -0
  13. data/public/selenium-core-runner/RemoteRunner.html +101 -0
  14. data/public/selenium-core-runner/SeleniumLog.html +109 -0
  15. data/public/selenium-core-runner/TestPrompt.html +145 -0
  16. data/public/selenium-core-runner/TestRunner-splash.html +55 -0
  17. data/public/selenium-core-runner/TestRunner.hta +177 -0
  18. data/public/selenium-core-runner/TestRunner.html +177 -0
  19. data/public/selenium-core-runner/icons/all.png +0 -0
  20. data/public/selenium-core-runner/icons/continue.png +0 -0
  21. data/public/selenium-core-runner/icons/continue_disabled.png +0 -0
  22. data/public/selenium-core-runner/icons/pause.png +0 -0
  23. data/public/selenium-core-runner/icons/pause_disabled.png +0 -0
  24. data/public/selenium-core-runner/icons/selected.png +0 -0
  25. data/public/selenium-core-runner/icons/step.png +0 -0
  26. data/public/selenium-core-runner/icons/step_disabled.png +0 -0
  27. data/public/selenium-core-runner/iedoc-core.xml +1789 -0
  28. data/public/selenium-core-runner/iedoc.xml +1830 -0
  29. data/public/selenium-core-runner/lib/cssQuery/cssQuery-p.js +6 -0
  30. data/public/selenium-core-runner/lib/cssQuery/src/cssQuery-level2.js +142 -0
  31. data/public/selenium-core-runner/lib/cssQuery/src/cssQuery-level3.js +150 -0
  32. data/public/selenium-core-runner/lib/cssQuery/src/cssQuery-standard.js +53 -0
  33. data/public/selenium-core-runner/lib/cssQuery/src/cssQuery.js +356 -0
  34. data/public/selenium-core-runner/lib/prototype.js +2006 -0
  35. data/public/selenium-core-runner/lib/scriptaculous/builder.js +101 -0
  36. data/public/selenium-core-runner/lib/scriptaculous/controls.js +815 -0
  37. data/public/selenium-core-runner/lib/scriptaculous/dragdrop.js +915 -0
  38. data/public/selenium-core-runner/lib/scriptaculous/effects.js +958 -0
  39. data/public/selenium-core-runner/lib/scriptaculous/scriptaculous.js +47 -0
  40. data/public/selenium-core-runner/lib/scriptaculous/slider.js +283 -0
  41. data/public/selenium-core-runner/lib/scriptaculous/unittest.js +383 -0
  42. data/public/selenium-core-runner/lib/snapsie.js +91 -0
  43. data/public/selenium-core-runner/scripts/find_matching_child.js +69 -0
  44. data/public/selenium-core-runner/scripts/htmlutils.js +1623 -0
  45. data/public/selenium-core-runner/scripts/injection.html +72 -0
  46. data/public/selenium-core-runner/scripts/selenium-api.js +3240 -0
  47. data/public/selenium-core-runner/scripts/selenium-browserbot.js +2333 -0
  48. data/public/selenium-core-runner/scripts/selenium-browserdetect.js +153 -0
  49. data/public/selenium-core-runner/scripts/selenium-commandhandlers.js +379 -0
  50. data/public/selenium-core-runner/scripts/selenium-executionloop.js +175 -0
  51. data/public/selenium-core-runner/scripts/selenium-logging.js +148 -0
  52. data/public/selenium-core-runner/scripts/selenium-remoterunner.js +695 -0
  53. data/public/selenium-core-runner/scripts/selenium-testrunner.js +1362 -0
  54. data/public/selenium-core-runner/scripts/selenium-version.js +5 -0
  55. data/public/selenium-core-runner/scripts/ui-doc.html +803 -0
  56. data/public/selenium-core-runner/scripts/ui-element.js +1627 -0
  57. data/public/selenium-core-runner/scripts/ui-map-sample.js +979 -0
  58. data/public/selenium-core-runner/scripts/user-extensions.js +3 -0
  59. data/public/selenium-core-runner/scripts/user-extensions.js.sample +75 -0
  60. data/public/selenium-core-runner/scripts/xmlextras.js +153 -0
  61. data/public/selenium-core-runner/selenium-logo.png +0 -0
  62. data/public/selenium-core-runner/selenium-test.css +43 -0
  63. data/public/selenium-core-runner/selenium.css +316 -0
  64. data/public/selenium-core-runner/xpath/dom.js +566 -0
  65. data/public/selenium-core-runner/xpath/javascript-xpath-0.1.11.js +2816 -0
  66. data/public/selenium-core-runner/xpath/util.js +549 -0
  67. data/public/selenium-core-runner/xpath/xmltoken.js +149 -0
  68. data/public/selenium-core-runner/xpath/xpath.js +2481 -0
  69. metadata +121 -0
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem "rails", "3.0.5"
4
+ gem "capybara", ">= 0.4.0"
5
+ gem "sqlite3"
6
+
7
+ # To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
8
+ # gem 'ruby-debug'
9
+ # gem 'ruby-debug19'
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2011 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,3 @@
1
+ = SeleniumWebRunner
2
+
3
+ This project rocks and uses MIT-LICENSE.
data/Rakefile ADDED
@@ -0,0 +1,30 @@
1
+ # encoding: UTF-8
2
+ require 'rubygems'
3
+ begin
4
+ require 'bundler/setup'
5
+ rescue LoadError
6
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
7
+ end
8
+
9
+ require 'rake'
10
+ require 'rake/rdoctask'
11
+
12
+ require 'rake/testtask'
13
+
14
+ Rake::TestTask.new(:test) do |t|
15
+ t.libs << 'lib'
16
+ t.libs << 'test'
17
+ t.pattern = 'test/**/*_test.rb'
18
+ t.verbose = false
19
+ end
20
+
21
+ task :default => :test
22
+
23
+ Rake::RDocTask.new(:rdoc) do |rdoc|
24
+ rdoc.rdoc_dir = 'rdoc'
25
+ rdoc.title = 'SeleniumWebRunner'
26
+ rdoc.options << '--line-numbers' << '--inline-source'
27
+ rdoc.rdoc_files.include('README.rdoc')
28
+ rdoc.rdoc_files.include('lib/**/*.rb')
29
+ end
30
+
@@ -0,0 +1,19 @@
1
+ module SeleniumCoreRunner
2
+ class SuitesController < ApplicationController
3
+ def index
4
+ end
5
+
6
+ def show
7
+ path = params[:suite]
8
+ if params[:case].blank?
9
+ path = params[:suite]+".html"
10
+ else
11
+ path = params[:suite]+"/"+params[:case]
12
+ end
13
+ open(Rails.root.to_s+"/test/selenium/#{path}") {|f|
14
+ render :text=>f.read , :layout=>false
15
+ }
16
+ end
17
+ end
18
+ end
19
+
@@ -0,0 +1,177 @@
1
+ <html>
2
+
3
+ <head>
4
+ <HTA:APPLICATION ID="SeleniumHTARunner" APPLICATIONNAME="Selenium">
5
+ <!-- the previous line is only relevant if you rename this
6
+ file to "TestRunner.hta" -->
7
+
8
+ <!-- The copyright notice and other comments have been moved to after the HTA declaration,
9
+ to work-around a bug in IE on Win2K whereby the HTA application doesn't function correctly -->
10
+ <!--
11
+ Copyright 2004 ThoughtWorks, Inc
12
+
13
+ Licensed under the Apache License, Version 2.0 (the "License");
14
+ you may not use this file except in compliance with the License.
15
+ You may obtain a copy of the License at
16
+
17
+ http://www.apache.org/licenses/LICENSE-2.0
18
+
19
+ Unless required by applicable law or agreed to in writing, software
20
+ distributed under the License is distributed on an "AS IS" BASIS,
21
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
+ See the License for the specific language governing permissions and
23
+ limitations under the License.
24
+ -->
25
+ <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"/>
26
+
27
+ <title>Selenium Functional Test Runner</title>
28
+ <link rel="stylesheet" type="text/css" href="selenium.css"/>
29
+ <script type="text/javascript" src="scripts/xmlextras.js"></script>
30
+ <script language="JavaScript" type="text/javascript" src="lib/prototype.js"></script>
31
+ <script language="JavaScript" type="text/javascript" src="lib/cssQuery/cssQuery-p.js"></script>
32
+ <script language="JavaScript" type="text/javascript" src="lib/snapsie.js"></script>
33
+ <script language="JavaScript" type="text/javascript" src="scripts/htmlutils.js"></script>
34
+ <script language="JavaScript" type="text/javascript" src="scripts/ui-element.js"></script>
35
+ <script language="JavaScript" type="text/javascript" src="lib/scriptaculous/scriptaculous.js"></script>
36
+ <script language="JavaScript" type="text/javascript" src="scripts/selenium-browserdetect.js"></script>
37
+ <script language="JavaScript" type="text/javascript" src="scripts/selenium-browserbot.js"></script>
38
+ <script language="JavaScript" type="text/javascript" src="scripts/find_matching_child.js"></script>
39
+ <script language="JavaScript" type="text/javascript" src="scripts/selenium-api.js"></script>
40
+ <script language="JavaScript" type="text/javascript" src="scripts/selenium-commandhandlers.js"></script>
41
+ <script language="JavaScript" type="text/javascript" src="scripts/selenium-executionloop.js"></script>
42
+ <script language="JavaScript" type="text/javascript" src="scripts/selenium-testrunner.js"></script>
43
+ <script language="JavaScript" type="text/javascript" src="scripts/selenium-logging.js"></script>
44
+ <script language="JavaScript" type="text/javascript" src="scripts/selenium-version.js"></script>
45
+ <script language="JavaScript" type="text/javascript" src="xpath/util.js"></script>
46
+ <script language="JavaScript" type="text/javascript" src="xpath/xmltoken.js"></script>
47
+ <script language="JavaScript" type="text/javascript" src="xpath/dom.js"></script>
48
+ <script language="JavaScript" type="text/javascript" src="xpath/xpath.js"></script>
49
+ <script language="JavaScript" type="text/javascript" src="xpath/javascript-xpath-0.1.11.js"></script>
50
+ <script language="JavaScript" type="text/javascript" src="scripts/user-extensions.js"></script>
51
+ <script language="JavaScript" type="text/javascript">
52
+ function openDomViewer() {
53
+ var autFrame = document.getElementById('selenium_myiframe');
54
+ var autFrameDocument = new SeleniumFrame(autFrame).getDocument();
55
+ this.rootDocument = autFrameDocument;
56
+ var domViewer = window.open(getDocumentBase(document) + 'domviewer/domviewer.html');
57
+ return false;
58
+ }
59
+ </script>
60
+ </head>
61
+
62
+ <body onLoad="onSeleniumLoad();">
63
+ <table class="layout">
64
+ <form action="" name="controlPanel">
65
+
66
+ <!-- Suite, Test, Control Panel -->
67
+
68
+ <tr class="selenium">
69
+ <td width="25%" height="30%">
70
+ <iframe name="testSuiteFrame" id="testSuiteFrame" src="./TestPrompt.html" application="yes"></iframe>
71
+ </td>
72
+ <td width="50%" height="30%">
73
+ <iframe name="testFrame" id="testFrame" application="yes" src="Blank.html"></iframe>
74
+ </td>
75
+
76
+ <td width="25%">
77
+ <table class="layout">
78
+ <tr class="selenium">
79
+ <th width="25%" height="1" class="header">
80
+ <h1><a href="http://selenium.openqa.org" title="The Selenium Project">Selenium</a> TestRunner
81
+ </h1>
82
+ </th>
83
+ </tr>
84
+ <tr>
85
+ <td width="25%" height="30%" id="controlPanel">
86
+ <fieldset>
87
+ <legend>Execute Tests</legend>
88
+
89
+ <div id="imageButtonPanel">
90
+ <button type="button" id="runSuite" onClick="htmlTestRunner.startTestSuite();"
91
+ title="Run All tests" accesskey="a">
92
+ </button>
93
+ <button type="button" id="runSeleniumTest" onClick="htmlTestRunner.runSingleTest();"
94
+ title="Run the Selected test" accesskey="r">
95
+ </button>
96
+ <button type="button" id="pauseTest" disabled="disabled"
97
+ title="Pause/Continue" accesskey="p" class="cssPauseTest">
98
+ </button>
99
+ <button type="button" id="stepTest" disabled="disabled"
100
+ title="Step" accesskey="s">
101
+ </button>
102
+ </div>
103
+
104
+ <div style="float:left">Fast</div>
105
+ <div style="float:right">Slow</div>
106
+ <br/>
107
+ <div id="speedSlider">
108
+ <div id="speedTrack">&nbsp;</div>
109
+ <div id="speedHandle">&nbsp;</div>
110
+ </div>
111
+
112
+ <div class="executionOptions">
113
+ <input id="highlightOption" type="checkbox" name="highlightOption" value="0"/>
114
+ <label for="highlightOption">Highlight elements</label>
115
+ </div>
116
+
117
+ </fieldset>
118
+
119
+ <table id="stats" align="center">
120
+ <tr>
121
+ <td colspan="2" align="right">Elapsed:</td>
122
+ <td id="elapsedTime" colspan="2">00.00</td>
123
+ </tr>
124
+ <tr>
125
+ <th colspan="2">Tests</th>
126
+ <th colspan="2">Commands</th>
127
+ </tr>
128
+ <tr>
129
+ <td class="count" id="testRuns">0</td>
130
+ <td>run</td>
131
+ <td class="count" id="commandPasses">0</td>
132
+ <td>passed</td>
133
+ </tr>
134
+ <tr>
135
+ <td class="count" id="testFailures">0</td>
136
+ <td>failed</td>
137
+ <td class="count" id="commandFailures">0</td>
138
+ <td>failed</td>
139
+ </tr>
140
+ <tr>
141
+ <td colspan="2"></td>
142
+ <td class="count" id="commandErrors">0</td>
143
+ <td>incomplete</td>
144
+ </tr>
145
+ </table>
146
+
147
+ <fieldset>
148
+ <legend>Tools</legend>
149
+
150
+ <button type="button" id="domViewer1" onClick="openDomViewer();">
151
+ View DOM
152
+ </button>
153
+ <button type="button" onClick="LOG.show();">
154
+ Show Log
155
+ </button>
156
+
157
+ </fieldset>
158
+
159
+ </td>
160
+ </tr>
161
+ </table>
162
+ </td>
163
+ </tr>
164
+
165
+ <!-- AUT -->
166
+
167
+ <tr>
168
+ <td colspan="3" height="70%">
169
+ <iframe name="selenium_myiframe" id="selenium_myiframe" src="TestRunner-splash.html"></iframe>
170
+ </td>
171
+ </tr>
172
+
173
+ </form>
174
+ </table>
175
+
176
+ </body>
177
+ </html>
data/config/routes.rb ADDED
@@ -0,0 +1,6 @@
1
+ Rails.application.routes.draw do |map|
2
+ match 'selenium-core-runner', :to => redirect("/selenium-core-runner/index")
3
+ match 'selenium-core-runner/index' => 'selenium_core_runner/suites#index', :as => :selenium_core_runner
4
+ match 'selenium-core-runner/:suite' => 'selenium_core_runner/suites#show', :as => 'selenium_core_runner_suite'
5
+ match 'selenium-core-runner/:suite/:case' => 'selenium_core_runner/suites#show', :as => 'selenium_core_runner_suite'
6
+ end
@@ -0,0 +1,19 @@
1
+ #lib/authr/engine.rb
2
+ require "selenium-core-runner"
3
+ require "rails"
4
+
5
+ module SeleniumWebRunner
6
+ class Engine < Rails::Engine
7
+ initializer "static assets" do |app|
8
+ app.middleware.use ::ActionDispatch::Static, "#{root}/public"
9
+ end
10
+ # paths.app << 'lib/app'
11
+ # paths.app.views << 'lib/app/views'
12
+ # paths.config.routes << "lib/config/routes.rb"
13
+ # paths.config.locales << 'lib/config/locales'
14
+ end
15
+ end
16
+
17
+
18
+
19
+
@@ -0,0 +1,3 @@
1
+ module SeleniumWebRunner
2
+ require 'selenium-core-runner/engine' if defined?(Rails)
3
+ end
@@ -0,0 +1,7 @@
1
+ <html>
2
+ <head>
3
+ <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
4
+ </head>
5
+ <body>
6
+ </body>
7
+ </html>
@@ -0,0 +1,8 @@
1
+ <html>
2
+ <head>
3
+ <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
4
+ </head>
5
+ <body>
6
+ <h3>selenium-rc initial page</h3>
7
+ </body>
8
+ </html>
@@ -0,0 +1,101 @@
1
+ <html>
2
+
3
+ <!--
4
+ Copyright 2004 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
+ <HTA:APPLICATION ID="SeleniumHTARunner" APPLICATIONNAME="Selenium" >
19
+ <head>
20
+ <meta content="text/html; charset=ISO-8859-1"
21
+ http-equiv="content-type">
22
+ <title>Selenium Remote Control</title>
23
+ <link rel="stylesheet" type="text/css" href="selenium.css" />
24
+ <script type="text/javascript" src="scripts/xmlextras.js"></script>
25
+ <script language="JavaScript" type="text/javascript" src="lib/prototype.js"></script>
26
+ <script language="JavaScript" type="text/javascript" src="lib/cssQuery/cssQuery-p.js"></script>
27
+ <script language="JavaScript" type="text/javascript" src="lib/snapsie.js"></script>
28
+ <script language="JavaScript" type="text/javascript" src="scripts/htmlutils.js"></script>
29
+ <script language="JavaScript" type="text/javascript" src="scripts/ui-element.js"></script>
30
+ <script language="JavaScript" type="text/javascript" src="scripts/selenium-browserdetect.js"></script>
31
+ <script language="JavaScript" type="text/javascript" src="scripts/selenium-browserbot.js"></script>
32
+ <script language="JavaScript" type="text/javascript" src="scripts/find_matching_child.js"></script>
33
+ <script language="JavaScript" type="text/javascript" src="scripts/selenium-api.js"></script>
34
+ <script language="JavaScript" type="text/javascript" src="scripts/selenium-commandhandlers.js"></script>
35
+ <script language="JavaScript" type="text/javascript" src="scripts/selenium-executionloop.js"></script>
36
+ <script language="JavaScript" type="text/javascript" src="scripts/selenium-remoterunner.js"></script>
37
+ <script language="JavaScript" type="text/javascript" src="scripts/selenium-logging.js"></script>
38
+ <script language="JavaScript" type="text/javascript" src="scripts/selenium-version.js"></script>
39
+ <script language="JavaScript" type="text/javascript" src="xpath/util.js"></script>
40
+ <script language="JavaScript" type="text/javascript" src="xpath/xmltoken.js"></script>
41
+ <script language="JavaScript" type="text/javascript" src="xpath/dom.js"></script>
42
+ <script language="JavaScript" type="text/javascript" src="xpath/xpath.js"></script>
43
+ <script language="JavaScript" type="text/javascript" src="xpath/javascript-xpath-0.1.11.js"></script>
44
+ <script language="JavaScript" type="text/javascript" src="scripts/user-extensions.js"></script>
45
+ <script language="JavaScript" type="text/javascript">
46
+
47
+ function cleanUp() {
48
+ if (LOG != null) {
49
+ LOG.close();
50
+ }
51
+ }
52
+
53
+ </script>
54
+ </head>
55
+
56
+ <body onLoad="setTimeout(function(){runSeleniumTest();},1000)" onUnload="cleanUp()">
57
+
58
+ <table border="1" style="height: 100%; width: 100%;">
59
+ <tr>
60
+ <td width="50%">
61
+ <table>
62
+ <tr>
63
+ <td class="remoterunner">
64
+ <h4><a href="http://selenium.openqa.org">Selenium</a> Functional Testing for Web Apps</h4>
65
+ Open Source From <a href="http://selenium.openqa.org/thoughtworks-and-friends.html">ThoughtWorks and Friends</a>
66
+ <form action="">
67
+ <br/>
68
+ <iframe id="seleniumLoggingFrame" name="seleniumLoggingFrame" src="Blank.html" style="border: 0; height: 0; width: 0; "></iframe>
69
+ <fieldset>
70
+ <button type="button" onclick="LOG.show();">
71
+ Show Log
72
+ </button>
73
+ <label><INPUT TYPE="CHECKBOX" NAME="FASTMODE" VALUE="YES" onmouseup="slowClicked()"> Slow Mode</label>
74
+ </fieldset>
75
+
76
+ </form>
77
+
78
+ </td>
79
+ </tr>
80
+ </table>
81
+ <form action="">
82
+ <label id="context" name="context"></label>
83
+ </form>
84
+ </td>
85
+ <td width="50%" class="remoterunner">
86
+ <h4>Command History:</h4>
87
+ <form name="commands">
88
+ <textarea style="overflow:auto; height:8em; width:100%" wrap="off" id="commandList"></textarea>
89
+ </form>
90
+ </td>
91
+ </tr>
92
+ <tr>
93
+ <td colspan="2" height="100%">
94
+ <iframe name="selenium_myiframe" id="selenium_myiframe" src="Blank.html" height="100%" width="100%"></iframe>
95
+ </td>
96
+ </tr>
97
+ </table>
98
+
99
+ </body>
100
+ </html>
101
+
@@ -0,0 +1,109 @@
1
+ <html>
2
+
3
+ <head>
4
+ <title>Selenium Log Console</title>
5
+ <link id="cssLink" rel="stylesheet" href="selenium.css" />
6
+ <script src="scripts/htmlutils.js"></script>
7
+ <script language="JavaScript">
8
+
9
+ var disabled = true;
10
+
11
+ function logOnLoad() {
12
+ var urlConfig = new URLConfiguration();
13
+ urlConfig.queryString = window.location.search.substr(1);
14
+ var startingThreshold = urlConfig._getQueryParameter("startingThreshold");
15
+ setThresholdLevel(startingThreshold);
16
+ var buttons = document.getElementsByTagName("input");
17
+ for (var i = 0; i < buttons.length; i++) {
18
+ addChangeListener(buttons[i]);
19
+ }
20
+ }
21
+
22
+ function enableButtons() {
23
+ var buttons = document.getElementsByTagName("input");
24
+ for (var i = 0; i < buttons.length; i++) {
25
+ buttons[i].disabled = false;
26
+ disabled = false;
27
+ }
28
+ }
29
+
30
+ function callBack() {}
31
+
32
+ function changeHandler() {
33
+ callBack(getThresholdLevel());
34
+ }
35
+
36
+ function addChangeListener(element) {
37
+ if (window.addEventListener && !window.opera)
38
+ element.addEventListener("click", changeHandler, true);
39
+ else if (window.attachEvent)
40
+ element.attachEvent("onclick", changeHandler);
41
+ }
42
+
43
+ var logLevels = {
44
+ debug: 0,
45
+ info: 1,
46
+ warn: 2,
47
+ error: 3
48
+ };
49
+
50
+ function getThresholdLevel() {
51
+ var buttons = document.getElementById('logLevelChooser').level;
52
+ for (var i = 0; i < buttons.length; i++) {
53
+ if (buttons[i].checked) {
54
+ return buttons[i].value;
55
+ }
56
+ }
57
+ }
58
+
59
+ function setThresholdLevel(logLevel) {
60
+ var buttons = document.getElementById('logLevelChooser').level;
61
+ for (var i = 0; i < buttons.length; i++) {
62
+ if (buttons[i].value==logLevel) {
63
+ buttons[i].checked = true;
64
+ }
65
+ else {
66
+ buttons[i].checked = false;
67
+ }
68
+ }
69
+ }
70
+
71
+ function append(message, logLevel) {
72
+ var logLevelThreshold = getThresholdLevel();
73
+ if (logLevels[logLevel] < logLevels[logLevelThreshold]) {
74
+ return;
75
+ }
76
+ var log = document.getElementById('log');
77
+ var newEntry = document.createElement('li');
78
+ newEntry.className = logLevel;
79
+ newEntry.appendChild(document.createTextNode(message));
80
+ log.appendChild(newEntry);
81
+ if (newEntry.scrollIntoView) {
82
+ newEntry.scrollIntoView();
83
+ }
84
+ }
85
+
86
+ </script>
87
+ </head>
88
+ <body id="logging-console" onload="logOnLoad();">
89
+
90
+
91
+
92
+ <div id="banner">
93
+ <form id="logLevelChooser">
94
+ <input id="level-error" type="radio" name="level" disabled='true'
95
+ value="error" /><label for="level-error">Error</label>
96
+ <input id="level-warn" type="radio" name="level" disabled='true'
97
+ value="warn" /><label for="level-warn">Warn</label>
98
+ <input id="level-info" type="radio" name="level" disabled='true'
99
+ value="info" /><label for="level-info">Info</label>
100
+ <input id="level-debug" type="radio" name="level" checked="yes" disabled='true'
101
+ value="debug" /><label for="level-debug">Debug</label>
102
+ </form>
103
+ <h1>Selenium Log Console</h1>
104
+ </div>
105
+
106
+ <ul id="log"></ul>
107
+
108
+ </body>
109
+ </html>