Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save yurodivuie/798787 to your computer and use it in GitHub Desktop.
Save yurodivuie/798787 to your computer and use it in GitHub Desktop.
window.contextTimeout = null;
var ctx;
var opac;
var fadeIn;
Selenium.prototype.doSetContext = function(context) {
function fade()
{
if (fadeIn > 0) {
opac = opac + 10;
}
else {
opac = opac - 10;
}
var moz_opac = opac / 100;
if (ctx) {
ctx.style.filter = "alpha(opacity=" + opac + ")";
ctx.style.opacity = moz_opac;
if (opac < 81 && opac > 1){
setTimeout(fade, 50);
}
else if (fadeIn > 0) {
fadeIn = 0;
setTimeout(fade, 2500);
}
}
}
var txt = new String(context);
if ( txt.indexOf("bubble") == -1 ) {
return;
}
else {
context = txt.substr(7);
}
opac = 1;
fadeIn = 1; //Are we fading in or fading out?
ctx = this.browserbot.getUserWindow().document.getElementById("selenium-context");
if (ctx) {
//this.browserbot.getUserWindow().document.body.removeChild(ctx);
clearTimeout(window.contextTimeout);
} else {
ctx = this.browserbot.getUserWindow().document.createElement("div");
}
ctx.setAttribute('id', "selenium-context");
ctx.style.zIndex = "500";
ctx.style.position = "fixed";
ctx.style.left = "50%";
ctx.style.top = "10px";
ctx.style.width = "500px";
ctx.style.maxHeight = "100px";
ctx.style.overflow = "hidden";
ctx.style.margin = "0 0 0 -250px";
ctx.style.padding = "5px";
ctx.style.MozBorderRadius = "8px";
ctx.style.borderRadius = "8px";
ctx.style.textAlign = "center";
ctx.style.font = "normal normal 20px/25px Arial,sans-serif";
ctx.style.background = "#000";
ctx.style.border = "1px solid #CCC";
ctx.style.color = "#EEE";
ctx.style.opacity = opac / 100;
ctx.style.filter = "alpha(opacity=" + opac + ")";
ctx.innerHTML = context;
this.browserbot.getUserWindow().document.body.appendChild(ctx);
setTimeout(fade, 50);
}
@yurodivuie
Copy link
Author

Forking so I can try to fix the IE issues.

@yurodivuie
Copy link
Author

Hmm, still has trouble with IE through saucelabs, although it works on my browser. Hmm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment