This is a migrated thread and some comments may be shown as answers.

"Object doesn't support property or method 'createEvent'" against IE11 in Enterprise Compatibility Mode

1 Answer 166 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Greg
Top achievements
Rank 1
Greg asked on 21 Oct 2016, 06:28 PM

We are using the Testing Framework (version 2016_3_0928_5) against a site that is forced to use IE 11 in Enterprise Compatibility Mode and we often see the following exception while executing the tests:

System.InvalidOperationException: Javascript call [var eventObjJSON = 'null';var eventObj = JSON.parse(eventObjJSON);var eventType = "HTMLEvents";var eventName = "change";var evt = document.createEvent(eventType);if (!evt) throw "Error creating event";var altKey = false;var ctrlKey = false;var shiftKey = false;var metaKey = false;if (eventType == "HTMLEvents" || !eventObj) {evt.initEvent(eventName, true, true);}else {if (eventObj.modifiers & 0x01)altKey = true;if (eventObj.modifiers & 0x02)ctrlKey = true;if (eventObj.modifiers & 0x04)shiftKey = true;if (eventObj.modifiers & 0x08)metaKey = true;if (eventType == "MouseEvents") {var button = 0;if (eventObj.button & 1)button = 0;else if (eventObj.button & 2)button = 2;else if (eventObj.button & 4)button = 1;var relatedTarget;if (eventObj.relatedTarget)relatedTarget = eval(eventObj.relatedTarget);evt.initMouseEvent(eventName, true, true, window, 0, eventObj.screenX, eventObj.screenY,0, 0, ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget);}else if (eventType == "KeyboardEvent") {var keyCode;var charCode;keyCode = eventObj.keyCode;if (eventName == "keypress") {charCode = eventObj.keyCode;}else {charCode = 0;}var keyNum = String.fromCharCode(parseInt(keyCode)).toUpperCase().charCodeAt(0);var keyIdentifier = "U+00" + keyNum.toString(16);evt.initKeyboardEvent(true, true, window,keyIdentifier,0, ctrlKey, altKey, shiftKey, metaKey);}}var target = document.getElementsByTagName('select')[1];target.dispatchEvent(evt);] failed! Please make sure the function exists and the call is using the correct prototype signature. Javascript error: TypeError: Object doesn't support property or method 'createEvent' 

Has anybody encountered a similar error and found a resolution?

Any help would be greatly appreciated.

Thank you,

Greg

1 Answer, 1 is accepted

Sort by
0
Elena
Telerik team
answered on 25 Oct 2016, 12:24 PM
Hi Greg,

Thank you for your feedback. Could you please share further details on the topic and when this exception is thrown in the logs. Does it appear for certain action steps or certain circumstances? Please generate your application log during such a faulty execution and provide it here. Please clear the log prior the execution to ensure only relative to the issue information will be recorded within the file. 

It would be quite helpful as well if you could provide direct access to your application along with a script that reproduces such an error for further investigation. I appreciate your cooperation! 

Regards,
Elena Tsvetkova
Telerik by Progress
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
Tags
General Discussions
Asked by
Greg
Top achievements
Rank 1
Answers by
Elena
Telerik team
Share this question
or