s.adm.leanft.leanft-selenium-java-sdk.1.0.1.source-code.highlight.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of leanft-selenium-java-sdk Show documentation
Show all versions of leanft-selenium-java-sdk Show documentation
LeanFT Selenium Java SDK extends the WebDriver API with additional locators and utilities
The newest version!
/*! (c) Copyright 2015 - 2018 Micro Focus or one of its affiliates. */
//
// 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
//
// Apache License 2.0 - Apache Software Foundation
// www.apache.org
// Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION ...
//
// 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.
var Util = {
extend: function (obj, properties) {
if (properties) {
Object.keys(properties).forEach(function (key) {
obj[key] = properties[key];
});
}
return obj;
}
}
var ContentUtils = {
ElementBorder: function (elem) {
this.overlay = document.createElement('div');
Util.extend(this.overlay.style, {
position: 'absolute',
display: 'none',
borderColor: '#444444',
borderStyle: 'solid',
zIndex: '9999',
boxSizing: 'content-box'
});
document.body.appendChild(this.overlay);
if (elem)
this.wrap(elem);
},
highlightElement: function (elem, t) {
elem.scrollIntoView(false);
var border = new this.ElementBorder(elem);
var count = 0;
t /= 150;
// Flash t times ((t/2)*on + (t/2)*off)
function drawRect() {
if (++count > t) {
border.remove();
return;
}
if (count % 2)
border.show();
else
border.hide();
window.setTimeout(drawRect, 150);
}
drawRect();
}
};
ContentUtils.ElementBorder.prototype = {
overlay: null,
elem: null,
show: function () {
this.overlay.style.display = 'block';
},
hide: function () {
this.overlay.style.display = 'none';
},
// Returns whether the wrapped element was changed.
wrap: function (elem) {
if (this.elem === elem)
return false;
this.elem = elem;
var border = 4;
function pixels(n) { return n + 'px'; }
var rect = this._calcRectForElement(elem);
// In Safari for
© 2015 - 2025 Weber Informatics LLC | Privacy Policy