2015-04-04 09:53:59 -07:00
|
|
|
// Licensed to the Software Freedom Conservancy (SFC) under one
|
|
|
|
|
// or more contributor license agreements. See the NOTICE file
|
|
|
|
|
// distributed with this work for additional information
|
|
|
|
|
// regarding copyright ownership. The SFC licenses this file
|
|
|
|
|
// to you 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
|
2014-11-12 19:33:37 +00:00
|
|
|
//
|
2015-04-04 09:53:59 -07:00
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
2014-11-12 19:33:37 +00:00
|
|
|
//
|
2015-04-04 09:53:59 -07:00
|
|
|
// 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)
|
2013-03-10 13:56:37 -07:00
|
|
|
* @private {!Window}
|
2010-06-22 18:52:07 +00:00
|
|
|
*/
|
2012-11-08 16:22:32 +00:00
|
|
|
bot.window_;
|
|
|
|
|
|
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.
|
|
|
|
|
*/
|
2020-11-27 15:46:30 +00:00
|
|
|
bot.getWindow = function () {
|
2011-01-26 13:28:56 +00:00
|
|
|
return bot.window_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets the window to be used for command execution.
|
|
|
|
|
*
|
|
|
|
|
* @param {!Window} win The window for command execution.
|
|
|
|
|
*/
|
2020-11-27 15:46:30 +00:00
|
|
|
bot.setWindow = function (win) {
|
2011-01-26 13:28:56 +00:00
|
|
|
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.
|
|
|
|
|
*/
|
2020-11-27 15:46:30 +00:00
|
|
|
bot.getDocument = function () {
|
2011-05-10 00:04:04 +00:00
|
|
|
return bot.window_.document;
|
|
|
|
|
};
|