I have suddenly started getting the error "Object doesn't support this property or method" at the statements .Exists of returned object from Find method. This is a widespread issue to a lot of different objects. The only way I know to get the test working is to change the statement to check the returned object for not null.
1. I don’t know if checking for not null will guarantee no problem accessing the properties of the objects.
2. This means I have to go through the whole test suite to change all of such statements
Also the same error message was logged for all of occurrences of accessing to exception property as show below:
What's changed between when it worked and when it failed? Did you upgrade TestComplete?
You are correct, the Find method is supposed to return a stub object if the object is not found with "Exists" as false. So, something changed here. A possibility could be that ViewArea (what you're calling the Find method from) failed at some point... you may have lost that object somewhere as well which would cause a number of issues. Double check further up the script for fail points prior to this.
We you able to find the solution?
Thank you all for your responses.
I will answer all of your questions here:
>>> What does the result of the variable "viewPort" return to you?
ViewPort is a WinFormsObject with properties as it should have. The image below shows some of them including the property Exists with value True:
As to response from tristaanogre
As I mentioned in my post, this happened to many objects not just this one. In all cases where the error occurred, the objects were found with Exists propertt being either False or True. The only change I can think of is to have .Net framework 4.8 installed. The error started after that.
>>> We you able to find the solution?
Someone else posted the same problem here about 4 months ago:
I also posted another problem which started widespread at the same time as this one. The other problem is in this thread:
Microsoft JScrip runtime error "Object not a collection"
How do you declare ViewArea?
Please post a bit more lines of your code.