Won't Fix
Last Updated: 06 Jun 2017 06:32 by ADMIN
Carl
Created on: 24 May 2017 19:03
Type: Bug Report
0
invalidoperationexception when selecting from html select element by Text or Value
Having issues with performing a Select on an HTMLSelect Element using Text or By Value.  TS appears to make the proper selection from the list but then immediately fails.
Failure Information:

ExecuteCommand failed!
InError set by the client. Client Error:
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')[5];target.dispatchEvent(evt);] failed! Please make sure the function exists and the call is using the correct prototype signature. Javascript error: [object Error] 
   at ArtOfTest.InternetExplorer.IECommandProcessor.InvokeFunction(String functionCall, Boolean useEval, Boolean returnJson, IHTMLDocument2 doc)
   at ArtOfTest.InternetExplorer.IECommandProcessor.InvokeEvent(IHTMLElement target, BrowserCommand command)
   at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessActionCommands(BrowserCommand request)
   at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessCommandInternal(WebBrowserClass ieInstance, BrowserCommand request, IHTMLDocument2 document)
BrowserCommand (Type:'Action',Info:'NotSet',Action:'InvokeEvent',Target:'ElementId (tagName: 'select',occurrenceIndex: '5')',Data:'onchange--@@--null',ClientId:'Client_0bf8109b-3530-46b9-8bd2-77e5b8e60970',HasFrames:'False',FramesInfo:'',TargetFrameIndex:'-1',InError:'True',Response:'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')[5];target.dispatchEvent(evt);] failed! Please make sure the function exists and the call is using the correct prototype signature. Javascript error: [object Error] 
   at ArtOfTest.InternetExplorer.IECommandProcessor.InvokeFunction(String functionCall, Boolean useEval, Boolean returnJson, IHTMLDocument2 doc)
   at ArtOfTest.InternetExplorer.IECommandProcessor.InvokeEvent(IHTMLElement target, BrowserCommand command)
   at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessActionCommands(BrowserCommand request)
   at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessCommandInternal(WebBrowserClass ieInstance, BrowserCommand request, IHTMLDocument2 document)')
InnerException: none.

InnerException:
ArtOfTest.WebAii.Exceptions.ExecuteCommandException: ExecuteCommand failed!
InError set by the client. Client Error:
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')[5];target.dispatchEvent(evt);] failed! Please make sure the function exists and the call is using the correct prototype signature. Javascript error: [object Error] 
   at ArtOfTest.InternetExplorer.IECommandProcessor.InvokeFunction(String functionCall, Boolean useEval, Boolean returnJson, IHTMLDocument2 doc)
   at ArtOfTest.InternetExplorer.IECommandProcessor.InvokeEvent(IHTMLElement target, BrowserCommand command)
   at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessActionCommands(BrowserCommand request)
   at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessCommandInternal(WebBrowserClass ieInstance, BrowserCommand request, IHTMLDocument2 document)
BrowserCommand (Type:'Action',Info:'NotSet',Action:'InvokeEvent',Target:'ElementId (tagName: 'select',occurrenceIndex: '5')',Data:'onchange--@@--null',ClientId:'Client_0bf8109b-3530-46b9-8bd2-77e5b8e60970',HasFrames:'False',FramesInfo:'',TargetFrameIndex:'-1',InError:'True',Response:'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')[5];target.dispatchEvent(evt);] failed! Please make sure the function exists and the call is using the correct prototype signature. Javascript error: [object Error] 
   at ArtOfTest.InternetExplorer.IECommandProcessor.InvokeFunction(String functionCall, Boolean useEval, Boolean returnJson, IHTMLDocument2 doc)
   at ArtOfTest.InternetExplorer.IECommandProcessor.InvokeEvent(IHTMLElement target, BrowserCommand command)
   at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessActionCommands(BrowserCommand request)
   at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessCommandInternal(WebBrowserClass ieInstance, BrowserCommand request, IHTMLDocument2 document)')
InnerException: none.

   at ArtOfTest.WebAii.Core.Browser.ExecuteCommandInternal(BrowserCommand request)
   at ArtOfTest.WebAii.Core.Browser.ExecuteCommand(BrowserCommand request, Boolean performDomRefresh, Boolean waitUntilReady)
   at ArtOfTest.WebAii.Core.Browser.ExecuteCommand(BrowserCommand request)
   at ArtOfTest.WebAii.Core.Actions.InvokeEvent(Element targetElement, ScriptEventType eventType)
   at ArtOfTest.WebAii.Controls.HtmlControls.HtmlControl.InvokeEvent(ScriptEventType eventType)
   at ArtOfTest.WebAii.Controls.HtmlControls.HtmlSelect.InvokeOnChange(Boolean initEvent)
   at ArtOfTest.WebAii.Design.IntrinsicTranslators.Descriptors.SelectDropDownActionDescriptor.Execute(Browser browser)
   at ArtOfTest.WebAii.Design.Extensibility.HtmlActionDescriptor.Execute(IAutomationHost autoHost)
   at ArtOfTest.WebAii.Design.Execution.ExecutionEngine.ExecuteStep(Int32 order)
3 comments
ADMIN
Ivaylo
Posted on: 06 Jun 2017 06:31
Thank you for the ticket submitted. I am now closing this feedback. Please refer to the ticket for more information.
Carl
Posted on: 05 Jun 2017 15:40
Submitted support ticket 1112642 with web page, login information and steps to recreate.
ADMIN
Ivaylo
Posted on: 01 Jun 2017 06:57
Hello Carl,

Please note that this behavior is observed when you are using an older version of IE. Please note that as of Test Studio R2 2016 we support only IE11. Another problem is if you are using IE11 in compatibility mode, please note that is also not supported.

Please also note that some applications require older version and this is achieved as demonstrated in the following article: 
https://msdn.microsoft.com/en-us/library/jj676915(v=vs.85).aspx 

If you are using IE11 and not using compatibility mode then we will need access to the application your are testing so we can replicate this behavior and investigate further.

Best Regards,
Ivaylo