Forum Discussion
mrpalmtree19
14 years agoOccasional Contributor
Here's some code I wrote to interact with that window. Even though it uses pixel locations to click on the buttons, I've found it to be very stable. There's only two ways the bar is displayed (excluding when the window is so small that the buttons don't fit), and those two ways can be detected by the object's height.
Note that this code is part of a larger framework I'm using, so it won't work without some modification.
//****m* WebInterface/Web_Tab_Obj.prototype.IE_NotificationBar_ClickButton
// PURPOSE
// Clicks a button in the notifcation bar in IE.
// SOURCE
Web_Tab_Obj.prototype.IE_NotificationBar_ClickButton = function(button)
{
var bar = this.IE_NotificationBar_Get();
if (bar.Exists && bar.Visible)
{
switch (aqString.ToLower(button))
{
case "close":
bar.Click(bar.width-15, 22);
break;
case "open":
if (bar.height > 54)
bar.Click(bar.width-200, 55);
else
bar.Click(bar.width-222, 23);
break;
case "save as":
//open save drop down
if (bar.height > 54)
bar.Click(bar.width-94, 55);
else
bar.Click(bar.width-115, 23);
Delay(999);
bar.Keys("a"); //select save as
break;
default:
Log.Error("This button hasn't been implemented yet");
}
}
else
Log.Error("Notification bar did not exist");
}
//****
Note that this code is part of a larger framework I'm using, so it won't work without some modification.
//****m* WebInterface/Web_Tab_Obj.prototype.IE_NotificationBar_ClickButton
// PURPOSE
// Clicks a button in the notifcation bar in IE.
// SOURCE
Web_Tab_Obj.prototype.IE_NotificationBar_ClickButton = function(button)
{
var bar = this.IE_NotificationBar_Get();
if (bar.Exists && bar.Visible)
{
switch (aqString.ToLower(button))
{
case "close":
bar.Click(bar.width-15, 22);
break;
case "open":
if (bar.height > 54)
bar.Click(bar.width-200, 55);
else
bar.Click(bar.width-222, 23);
break;
case "save as":
//open save drop down
if (bar.height > 54)
bar.Click(bar.width-94, 55);
else
bar.Click(bar.width-115, 23);
Delay(999);
bar.Keys("a"); //select save as
break;
default:
Log.Error("This button hasn't been implemented yet");
}
}
else
Log.Error("Notification bar did not exist");
}
//****