0

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;
    }
Navoneel Talukdar
  • 4,393
  • 5
  • 21
  • 42
John
  • 89
  • 1
  • 10
  • Possible duplicate of [Object doesn't support property or method 'attachEvent' InternetExplorer 11](http://stackoverflow.com/questions/28659450/object-doesnt-support-property-or-method-attachevent-internetexplorer-11) – timbre timbre May 03 '16 at 17:14
  • I agree ! :) i have rectified the issue. – John May 04 '16 at 13:38

0 Answers0