I'm facing the subjected issue while launching IE 11 in selenium.jar.
I googled and found some solution like IE 11 needs AttachEvent
handler instead of attach event in the js file. but i dont know how to modify since i'm new to js. Can someone please let me know how to do the changes.
Code below.
IEBrowserBot.prototype.modifySeparateTestWindowToDetectPageLoads = function(windowObject) {
this.pageUnloading = false;
var self = this;
var pageUnloadDetector = function() {
self.pageUnloading = true;
};
windowObject.attachEvent("onbeforeunload", pageUnloadDetector);
BrowserBot.prototype.modifySeparateTestWindowToDetectPageLoads.call(this, windowObject);
};
IEBrowserBot.prototype._fireEventOnElement = function(eventType, element, clientX, clientY) {
var win = this.getCurrentWindow();
triggerEvent(element, 'focus', false);
var wasChecked = element.checked;
// Set a flag that records if the page will unload - this isn't always accurate, because
// <a href="javascript:alert('foo'):"> triggers the onbeforeunload event, even thought the page won't unload
var pageUnloading = false;
var pageUnloadDetector = function() {
pageUnloading = true;
};
win.attachEvent("onbeforeunload", pageUnloadDetector);
this._modifyElementTarget(element);
if (element[eventType]) {
element[eventType]();
}
else {
this.browserbot.triggerMouseEvent(element, eventType, true, clientX, clientY);
}
// If the page is going to unload - still attempt to fire any subsequent events.
// However, we can't guarantee that the page won't unload half way through, so we need to handle exceptions.
try {
win.detachEvent("onbeforeunload", pageUnloadDetector);
if (this._windowClosed(win)) {
return;
}