2010-07-25 21:06:09 +00:00
|
|
|
// Copyright 2010 WebDriver committers
|
|
|
|
|
// Copyright 2010 Google Inc.
|
|
|
|
|
//
|
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
|
//
|
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
//
|
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
|
// limitations under the License.
|
2010-06-22 18:52:07 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @fileoverview Overall configuration of the browser automation atoms.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
goog.provide('bot');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Frameworks using the atoms keep track of which window or frame is currently
|
2011-02-26 08:25:54 +00:00
|
|
|
* being used for command execution. Note that "window" may not always be
|
|
|
|
|
* defined (for example in firefox extensions)
|
2011-01-26 13:28:56 +00:00
|
|
|
*
|
|
|
|
|
* @type {!Window}
|
2010-06-22 18:52:07 +00:00
|
|
|
* @private
|
|
|
|
|
*/
|
2011-02-26 10:42:38 +00:00
|
|
|
try {
|
|
|
|
|
bot.window_ = window;
|
|
|
|
|
} catch (ignored) {
|
|
|
|
|
// We only reach this place in a firefox extension.
|
|
|
|
|
bot.window_ = goog.global;
|
|
|
|
|
}
|
2010-06-22 18:52:07 +00:00
|
|
|
|
2011-01-26 13:28:56 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns the window currently being used for command execution.
|
|
|
|
|
*
|
|
|
|
|
* @return {!Window} The window for command execution.
|
|
|
|
|
*/
|
|
|
|
|
bot.getWindow = function() {
|
|
|
|
|
return bot.window_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets the window to be used for command execution.
|
|
|
|
|
*
|
|
|
|
|
* @param {!Window} win The window for command execution.
|
|
|
|
|
*/
|
|
|
|
|
bot.setWindow = function(win) {
|
|
|
|
|
bot.window_ = win;
|
|
|
|
|
};
|
2011-03-24 17:40:36 +00:00
|
|
|
|
2011-05-10 00:04:04 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns the document of the window currently being used for
|
|
|
|
|
* command execution.
|
|
|
|
|
*
|
|
|
|
|
* @return {!Document} The current window's document.
|
|
|
|
|
*/
|
|
|
|
|
bot.getDocument = function() {
|
|
|
|
|
return bot.window_.document;
|
|
|
|
|
};
|