forked from applitools/Eyes.Selenium.JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFrame.js
More file actions
70 lines (60 loc) · 2.27 KB
/
Frame.js
File metadata and controls
70 lines (60 loc) · 2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
(function() {
'use strict';
var EyesUtils = require('eyes.utils');
var ArgumentGuard = EyesUtils.ArgumentGuard;
/**
* @constructor
* @param {Object} logger A Logger instance.
* @param {WebElement} reference The web element for the frame, used as a reference to switch into the frame.
* @param {string} frameId The id of the frame. Can be used later for comparing two frames.
* @param {{x: number, y: number}} location The location of the frame within the current frame.
* @param {{width: number, height: number}} size The frame element size (i.e., the size of the frame on the screen, not the internal document size).
* @param {{x: number, y: number}} parentScrollPosition The scroll position the frame's parent was in when the frame was switched to.
*/
function Frame(logger, reference, frameId, location, size, parentScrollPosition) {
ArgumentGuard.notNull(logger, "logger");
ArgumentGuard.notNull(reference, "reference");
ArgumentGuard.notNull(frameId, "frameId");
ArgumentGuard.notNull(location, "location");
ArgumentGuard.notNull(size, "size");
ArgumentGuard.notNull(parentScrollPosition, "parentScrollPosition");
logger.verbose("Frame(logger, reference, " + frameId + ", ", location, ", ", size, ", ", parentScrollPosition, ")");
this._logger = logger;
this._reference = reference;
this._id = frameId;
this._parentScrollPosition = parentScrollPosition;
this._size = size;
this._location = location;
}
/**
* @returns {WebElement}
*/
Frame.prototype.getReference = function () {
return this._reference;
};
/**
* @returns {string}
*/
Frame.prototype.getId = function () {
return this._id;
};
/**
* @returns {{x: number, y: number}}
*/
Frame.prototype.getLocation = function () {
return this._location;
};
/**
* @returns {{width: number, height: number}}
*/
Frame.prototype.getSize = function () {
return this._size;
};
/**
* @returns {{x: number, y: number}}
*/
Frame.prototype.getParentScrollPosition = function () {
return this._parentScrollPosition;
};
module.exports = Frame;
}());