Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
SeleniumHQ
GitHub Repository: SeleniumHQ/Selenium
Path: blob/trunk/javascript/atoms/bot.js
1864 views
1
// Licensed to the Software Freedom Conservancy (SFC) under one
2
// or more contributor license agreements. See the NOTICE file
3
// distributed with this work for additional information
4
// regarding copyright ownership. The SFC licenses this file
5
// to you under the Apache License, Version 2.0 (the
6
// "License"); you may not use this file except in compliance
7
// with the License. You may obtain a copy of the License at
8
//
9
// http://www.apache.org/licenses/LICENSE-2.0
10
//
11
// Unless required by applicable law or agreed to in writing,
12
// software distributed under the License is distributed on an
13
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
// KIND, either express or implied. See the License for the
15
// specific language governing permissions and limitations
16
// under the License.
17
18
/**
19
* @fileoverview Overall configuration of the browser automation atoms.
20
*/
21
22
23
goog.provide('bot');
24
25
26
/**
27
* Frameworks using the atoms keep track of which window or frame is currently
28
* being used for command execution. Note that "window" may not always be
29
* defined (for example in firefox extensions)
30
* @private {!Window}
31
*/
32
bot.window_;
33
34
try {
35
bot.window_ = window;
36
} catch (ignored) {
37
// We only reach this place in a firefox extension.
38
bot.window_ = goog.global;
39
}
40
41
42
/**
43
* Returns the window currently being used for command execution.
44
*
45
* @return {!Window} The window for command execution.
46
*/
47
bot.getWindow = function () {
48
return bot.window_;
49
};
50
51
52
/**
53
* Sets the window to be used for command execution.
54
*
55
* @param {!Window} win The window for command execution.
56
*/
57
bot.setWindow = function (win) {
58
bot.window_ = win;
59
};
60
61
62
/**
63
* Returns the document of the window currently being used for
64
* command execution.
65
*
66
* @return {!Document} The current window's document.
67
*/
68
bot.getDocument = function () {
69
return bot.window_.document;
70
};
71
72