Having trouble with objects do not exist error
I am getting the objexts do not exist error when I am trying to do testing on a pop up window on my web page. It has worked once or twice, then I refreshed the page and that was it.
When I run the script, the errors appear, but when I go through all the elements, they are appearing as mapped as expected with the Aliases I am using the reference them in the code. I am getting really frustrated. Any ideas?
Sounds like timing issues. Are you sure whatever you're using is allowing enough time for them to appear?
(Usually, the easiest way to verify this is to put an excessively long wait in before the action on the popup. If that makes it work every time, then you were try to access it too early and you need to put something in to detect it before you use it. I wouldn't use a wait permenantly. Hardcoded waits are never good ...)
Either that, or dodgy runtime identification properties.
Thanks for the response - yes, I have tried a delay. We have constant data being updated, so I actually have to use it in a couple places to give the data time to load.
I was just able to run the script, but I have no idea how. Then, all of the sudden, it stopped working again. And again, when I look at the items, it still shows that they are mapped to the names I am using in the scripts.
And just to make it more fun - when I can run the script, it only works as a stand alone function. I can't call it from my main program because I get the does not exist error. I don't know what the difference is there or if it is even related, but maybe it's helpful.
Try adding the following command immediately after any delay. It will refresh the objects seen by TestComplete before continuing with the test. This command has the same affect as refreshing the display in the Object Browser.
if you can not call from main programe , probably u r doing something at there whitch may delay, overlap or changing properties of your object. just try and see only calling your sub routine nothing else in main programe.
What language are you scripting in?
That may have an effect depending what you're passing in to get to the function that fails.
•JScript, C++Script and C#Script do not support functions that obtain parameters by reference
May have something to do with it?
And, as dmiscannon says, adding a sys,refresh just before trying to use the object may help.
@dmiscannon - that didn't change anything. I took the delay out of my code since it didn't change anything, anyways
@nishera - As I said above, it works when calling it by itself. Although, there's been a fun development today. If I try to call it from the main program, then run stand alone again, it fails. If I only run it stand alone, it runs with no problems.
@colin_mccrae - Honestly? I didn't even understand what that page said, so I am pretty sure I am not doing that.
It is not like it is anything that is complicated at all. It's a simple procedure:
- Right click to open the menu
- Click two check boxes
- Confirm the columns were removed
- Refresh the web page
- Confirm the columns are still removed
- Right click
- Click Refresh (to bring back all columns)
- Confirm all the columns appear again
I use a variable for the object path for all the items because when I originally had the problem, I thought it was because I moved the items in the name mapping tab. Regardless, I tried it with the full path with no change in behavior.
- Call it stand alone directly in the code, it works.
- Call it as a function call from the main prgram, it fails
- Call it stand alone from the project, it works
- Call it stand alone after the main code has run, it fails
- Include code to open the webpage inside the function, it fails
- Call it stand alone after a function to open the webpage, but before the main code from the project, it works
And it's only Tuesday *SIGH*
Where exactly in your 8 steps does it fail?
And what is the error it fails with?
Looking at the 8 steps, I'm not clear which bits are on the main page and which parts are on the popup? Also, is this a dialog type popup or some sort of modal popup window generated by the application?
From what you're saying, it does sound like an identification issue. Do any of the identification properties used to identify your problem object (and all it's parents all the way up the tree) look likely to be varying at runtime? Like they contain big longs strings of random looking characters or something?
@colin_mccrae - when it is failing, it fails when trying to find the first checkbox, so step 2. It fails with objects do not exist error.
Hopefully this will clear up the steps as to where the actions/checks occur
- Right click on main page to open the right click menu
- Click two check boxes on right click menu
- Confirm the columns were removed on main page
- Refresh the main web page
- Confirm the columns are still removed on the main page
- Right click on the main page to open the right click menu
- Click Refresh on the right click menu to bring back all columns on main page
- Confirm all the columns appear on main page
I think if it is an identification issue, it is a really funky one. I use the type and the Full name as the identification properties. That seems to work best for my page. Every time it fails, I use the Display Object Spy to confirm that the fields are still mapped as expected and they are. Every freaking time.
I think if it was something as simple as that, then it would always fail and not just when it was run with other code.