1
<script language="JavaScript">
2
if (window["selenium_has_been_loaded_into_this_window"]==null)
6
// Some background on the code below: broadly speaking, where we are relative to other windows
7
// when running in proxy injection mode depends on whether we are in a frame set file or not.
9
// In regular HTML files, the selenium JavaScript is injected into an iframe called "selenium"
10
// in order to reduce its impact on the JavaScript environment (through namespace pollution,
11
// etc.). So in regular HTML files, we need to look at the parent of the current window when we want
12
// a handle to, e.g., the application window.
14
// In frame set files, we can't use an iframe, so we put the JavaScript in the head element and share
15
// the window with the frame set. So in this case, we need to look at the current window, not the
16
// parent when looking for, e.g., the application window. (TODO: Perhaps I should have just
17
// assigned a regular frame for selenium?)
19
BrowserBot.prototype.getContentWindow = function() {
23
BrowserBot.prototype.getTargetWindow = function(windowName) {
27
BrowserBot.prototype.getCurrentWindow = function() {
31
LOG.openLogWindow = function(message, className) {
35
BrowserBot.prototype.relayToRC = function(name) {
36
var object = eval(name);
37
var s = 'state:' + serializeObject(name, object) + "\n";
38
sendToRC(s,"state=true");
41
function selenium_frameRunTest(oldOnLoadRoutine) {
42
if (oldOnLoadRoutine) {
43
eval(oldOnLoadRoutine);
48
function seleniumOnLoad() {
49
injectedSessionId = "@SESSION_ID@";
50
window["selenium_has_been_loaded_into_this_window"] = true;
54
function seleniumOnUnload() {
55
sendToRC("Current window or frame is closed!", "closing=true");
58
if (window.addEventListener) {
59
window.addEventListener("load", seleniumOnLoad, false); // firefox
60
window.addEventListener("unload", seleniumOnUnload, false); // firefox
61
} else if (window.attachEvent){
62
window.attachEvent("onload", seleniumOnLoad); // IE
63
window.attachEvent("onunload", seleniumOnUnload); // IE
66
throw "causing a JavaScript error to tell the world that I did not arrange to be run on load";
69
injectedSessionId = "@SESSION_ID@";
70
proxyInjectionMode = true;