Hello,
sometimes I have "System.Reflection.TargetException: Object does not match target type." exception in HtmlInputCheckBox.Check() method.
Can anybody say what happens? And fix it.
The stackTrace is below.
Exception thrown executing coded step: 'Configure 'Repeat on' days'.
InnerException:
ArtOfTest.WebAii.Exceptions.ExecuteCommandException: ExecuteCommand failed!
InError set by the client. Client Error:
System.Reflection.TargetException: Object does not match target type.
at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at CallSite.Target(Closure , CallSite , Object , String , BindingFlags , Object , Object , Object )
at System.Dynamic.UpdateDelegates.UpdateAndExecute6[T0,T1,T2,T3,T4,T5,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)
at CallSite.Target(Closure , CallSite , Object , String , BindingFlags , Object , Object , Object )
at ArtOfTest.InternetExplorer.IECommandProcessor.InvokeFunction(String functionCall, Boolean useEval, Boolean returnJson, IHTMLDocument2 doc)
at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessActionCommands(BrowserCommand request)
at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessCommandInternal(WebBrowserClass ieInstance, BrowserCommand request, IHTMLDocument2 document)
BrowserCommand (Type:'Action',Info:'NotSet',Action:'InvokeJsFunction',Target:'ElementId (tagName: '',occurrenceIndex: '-1')',Data:'document.getElementsByTagName('input')[14].checked',ClientId:'Client_9419ea84-45a6-4dde-b63a-243e6f22aa03',HasFrames:'False',FramesInfo:'',TargetFrameIndex:'-1',InError:'True',Response:'System.Reflection.TargetException: Object does not match target type.
at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at CallSite.Target(Closure , CallSite , Object , String , BindingFlags , Object , Object , Object )
at System.Dynamic.UpdateDelegates.UpdateAndExecute6[T0,T1,T2,T3,T4,T5,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)
at CallSite.Target(Closure , CallSite , Object , String , BindingFlags , Object , Object , Object )
at ArtOfTest.InternetExplorer.IECommandProcessor.InvokeFunction(String functionCall, Boolean useEval, Boolean returnJson, IHTMLDocument2 doc)
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.Actions.InvokeScript(String script, Boolean refreshDom)
at ArtOfTest.WebAii.ObjectModel.Element.GetValue[T](String propertyName, T defaultValue)
at ArtOfTest.WebAii.ObjectModel.Element.GetValue[T](String propertyName)
at ArtOfTest.WebAii.Controls.HtmlControls.HtmlRadioCheckboxControl.get_Checked()
at ArtOfTest.WebAii.Controls.HtmlControls.HtmlRadioCheckboxControl.Check(Boolean isChecked)
7 Answers, 1 is accepted
Would you provide a bit more information on this case please?
Which product version do you use? Which browser version you are running on?
If using IE - please make sure that the application does not force the browser to act as lower than IE 11 version. If not using IE - make sure you are using latest Test Studio extensions available.
Is it possible using latest product version to reproduce this problem on a public facing application? Please provide further details if possible or provide sample test script.
I'm looking forward to hear from you.
Best Regards,
Nikolay Petrov
Progress Telerik
so after two years I still have this issue.
This is stable reproduced on Windows Server 2012 R2 (with all updates), IE version 11.0.9600.19463, update version 11.0.145
Test Studio version 192.6.19.0
The last trace (on the current versions) is attached.
I need the fix of it.
Thanks.
Hello Ivan,
I am sorry to know you still face an error in test execution and will be happy to assist you with resolving that.
Based on the exception it seems like there is something changing in the page right before Test Studio attempts to perform the check action of the checkbox. This, however, should happen really fast and is quite strange as of our perspective.
Therefore, to be able to understand more about the issue, I would need some further details on your end. Can you, please, go through the below topics and let me know your input on each of these?
- Do you see the misbehavior for a particular test or particular control?
- Is the error consistent or appears randomly?
- Is the test to produce the error a recorded one or runs all actions only in code?
- Does the application uses Ajax calls to get data from the server?
- Can you please try to add an Ajax timeout and an execution delay before that check action?
- If using a recorded step, you can enable the AjaxTimeout property of the step and set 10000ms, for example. Insert an execution delay of 3-5 sec right before that step.
- if using coded test, then add in the script before the failing action the following lines:
Manager.ActiveBrowser.WaitForAjax(10000); System.Threading.Thread.Sleep(5000);
- Once you apply the above mentioned changes in the test, please perform few runs and let me know of the outcome.
- If still facing the same error, please generate the application log during the failing test run and send it for further analysis. Ensure the log is cleared and enabled, start the test and collect the recorded logging after the test fails.
- If you can share a sample test which reproduces the error, it will be very helpful for me - that way I can explore the sequence of actions and if there is anything specific to keep in mind.
Thank you in advance for your time in our discussion. I will be looking forward to hearing back from you and continue the investigation.
Regards,
Elena
Progress Telerik
Hello Ivan,
I am sorry to know you still face an error in test execution and will be happy to assist you with resolving that.
Based on the exception it seems like there is something changing in the page right before Test Studio attempts to perform the check action of the checkbox. This, however, should happen really fast and is quite strange as of our perspective.
Therefore, to be able to understand more about the issue, I would need some further details on your end. Can you, please, go through the below topics and let me know your input on each of these?
- Do you see the misbehavior for a particular test or particular control? - No, I can't say that it is a stable problem for concrete test or control. But sometimes I get the problem in some steps considerably often than other. The same code is executed about one hundred times but only one or tow fails got besause this problem.
- Is the error consistent or appears randomly? - I would say randomly.
- Is the test to produce the error a recorded one or runs all actions only in code? - I am not sure that the steps were recorded (they may be copied from recorded steps). It is not coded steps exactly.
- Does the application uses Ajax calls to get data from the server? - Yes, it does.
- Can you please try to add an Ajax timeout and an execution delay before that check action? - I tried to do that I can say that where I did it I got fewer fails. In these places, I got the fails more rarely. But it happened. It is not a good solution. There are many steps with this problem. Too much overhead will be because of this in all tests. Please note, there was not this problem earlier and our project did not have important changes in this behavior.
- If using a recorded step, you can enable the AjaxTimeout property of the step and set 10000ms, for example. Insert an execution delay of 3-5 sec right before that step. - I can't use AjaxTimeout for verification steps like an item is enabled, for example, "Verify 'QuickLauncherNavigationButton' is enabled". Only actions have this property. I use a coded step with a delay before a step with the problem.
- if using coded test, then add in the script before the failing action the following lines:
-
Manager.ActiveBrowser.WaitForAjax(10000); System.Threading.Thread.Sleep(5000);
- Once you apply the above mentioned changes in the test, please perform few runs and let me know of the outcome.
- If still facing the same error, please generate the application log during the failing test run and send it for further analysis. Ensure the log is cleared and enabled, start the test and collect the recorded logging after the test fails. - Sorry, but I didn't understand which logging you mean. Could you give me more information?
- If you can share a sample test which reproduces the error, it will be very helpful for me - that way I can explore the sequence of actions and if there is anything specific to keep in mind. - I attached the screenshot with steps where one of them failed. These are very simple checks. There is no any AJAX before there all steps. So, we can say that the application didn't load data from a server.
Thank you in advance for your time in our discussion. I will be looking forward to hearing back from you and continue the investigation.
Regards,
Elena
Progress Telerik
i Ivan,
Thank you for sharing additional details on the case.
Based on these further notes I noticed the currently reported step that failed is a verification step and the initially reported error is generated from a step that checks a checkbox. Do you see the same error generated by the verification step? Can you, please, share step failure details for the failure from the screenshot?
The fact that the issue appears randomly, I suspect that these errors are generated due to some timing issues, so it will be important to drill down what these could be. And to be able to investigate the errors in further details, I will need some assistance on your end.
First thing to recommend will be to upgrade your Test Studio installation to the latest published - it is a Service Pack edition released last week. If you check for updates you should see a version 2019.3.1030 available for download - please, take the time to install that version and then proceed with the investigation.
Then, please, take some time to observe the test runs and generated results. Once you encounter any of the failures - the checkbox check or the verification failure, please open the particular test list results and collect the Step failure details. The easiest way for this will be to use the Export button on the Failure tab - please read more here. The exported zip file can be sent via this thread.
Having the complete overview for the tests that randomly generates these failures, I will be able to explore what might be causing the errors and will be able to provide specific advice for the particular case.
As a side note in this thread, I would like to discuss another ongoing queries submitted recently by you - it is about the issues with reading large result files. Since the so far suggested approach to overwhelm the difficulties with test results are not sufficient to cover your needs, my next suggestion will be to organize an online meeting - that way you could demonstrate the project specifics and requirement and we could suggest further optimizations.
Please, let me know if you can attend such an online screen share session to continue the discussion? If you are interested, please, share your time zone and availability.
Thank you in advance for your time and cooperation.
Regards,
Elena
Progress Telerik
Hi Elena,
so, one by one.
1. Yes, I see the same error
ArtOfTest.Common.Design.Exceptions.ExecutionException: ExecuteCommand failed!
InError set by the client. Client Error:
System.Reflection.TargetException: Object does not match target type.
at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at CallSite.Target(Closure , CallSite , Object , String , BindingFlags , Object , Object , Object )
at System.Dynamic.UpdateDelegates.UpdateAndExecute6[T0,T1,T2,T3,T4,T5,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)
at CallSite.Target(Closure , CallSite , Object , String , BindingFlags , Object , Object , Object )
at ArtOfTest.InternetExplorer.IECommandProcessor.InvokeFunction(String functionCall, Boolean useEval, Boolean returnJson, IHTMLDocument2 doc)
at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessActionCommands(BrowserCommand request)
at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessCommandInternal(WebBrowserClass ieInstance, BrowserCommand request, IHTMLDocument2 document)
BrowserCommand (Type:'Action',Info:'NotSet',Action:'InvokeJsFunction',Target:'ElementId (tagName: '',occurrenceIndex: '-1')',Data:'document.getElementsByTagName('input')[3].value',ClientId:'Client_3c9e0f06-90ca-4756-be57-7bbec5135954',HasFrames:'False',FramesInfo:'',TargetFrameIndex:'-1',InError:'True',Response:'System.Reflection.TargetException: Object does not match target type.
at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at CallSite.Target(Closure , CallSite , Object , String , BindingFlags , Object , Object , Object )
at System.Dynamic.UpdateDelegates.UpdateAndExecute6[T0,T1,T2,T3,T4,T5,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)
at CallSite.Target(Closure , CallSite , Object , String , BindingFlags , Object , Object , Object )
at ArtOfTest.InternetExplorer.IECommandProcessor.InvokeFunction(String functionCall, Boolean useEval, Boolean returnJson, IHTMLDocument2 doc)
at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessActionCommands(BrowserCommand request)
at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessCommandInternal(WebBrowserClass ieInstance, BrowserCommand request, IHTMLDocument2 document)')
InnerException: none.
This verification step is executed without any AJAX from a server. We just check all elements in a window according to selected combobox value. See tested window.png.
Before this failed step we already successfully checked nine cases. See all cases.png
When we change the combobox value, only refresh of components are executed on the window, no any AJAX
2. I know about the new version. I will install that and check. But it will take time. Maybe several days.
3. I attached exported failure details of the step from my screenshot.
4. Yes, we can have an online meeting. I have UTC+7 time zone and I am available from 9 AM to 4 PM from Monday to Friday. I can send you my project but I need a secure channel for that. Not here. Maybe email.
Hello Ivan,
Thank you for sharing these additional details - I will explore these further and will let you know if there is any suggestion on our end even before the meeting.
And when it comes to the online session, my suggestion is to conduct that one, when you manage to upgrade to the latest Test Studio release. I completely understand this may take you some time, so you can let me know when you are ready with that and then we can arrange a suitable time frame for both sides. What do you think of this option?
P.S. Can you, please, name the exact time zone you are in to avoid any misunderstanding in finding the suitable time frame for a meeting? It will be easier for me to compare it to my time zone.
Thank you once again for your cooperation and time spent in our discussion.
Regards,
Elena
Progress Telerik