Forum Discussion

mdragani's avatar
mdragani
Occasional Contributor
2 years ago

continuously getting 'Object cannot be found or 'object has been deleted'

Totally new using TestComplete. Using Keyword tests with simple cases. Running the test  individual test cases work one minute and then the next I get 'Object cannot be found' or 'Object has been deleted'.  I found the information on setting the wait time to a longer period but that isn't working either.  I am using Chrome and configured it according to the quide lines.  Any ideas what else can try. Basically the keyword tests will work and then they stop working

  • Are you running the web application on your local machine? I'm wondering whether the cached object that TC relies on, has been updated or deleted. See Refresh Name Mapping Cache. Calling method TestObj.Refresh() before each step might resolve the issue, but it's not ideal. Also, check that the parent object still remains the same.

     

    What version of TC are you using?

     

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    Are you running the web application on your local machine? I'm wondering whether the cached object that TC relies on, has been updated or deleted. See Refresh Name Mapping Cache. Calling method TestObj.Refresh() before each step might resolve the issue, but it's not ideal. Also, check that the parent object still remains the same.

     

    What version of TC are you using?

     

    • mdragani's avatar
      mdragani
      Occasional Contributor

      I wanted to wait to make sure the issue didn't reoccur but it has been over 24 hours now and i have NOT had the issue.  I believe you were totally correct when you stated the object(s) was getting cache after the first time running the KeywordTest and for some reason could not be called.  I fixed it by checking the 'Update Name Mapping during test run' in settings|options|Name Mapping.  Thanks again to everyone for their input. I am sure i will be asking more questions in the future 

       

       

    • mdragani's avatar
      mdragani
      Occasional Contributor

      I am running the latest version Version: 15.48.1.7 x64. And yes i am running the web application on my laptop.  Like i said it is happening for multiple objects ie.  The object "BrowserWindow" does not exist. 10:33:44 0.00. i will take a look at the Refresh Name Mapping Cache and see if that helps me at all.  Thank you

       

    • mdragani's avatar
      mdragani
      Occasional Contributor

      So i just realized i had already looked at the Refresh Name Mapping Cache but i am not positive how to incorporate it into a Keyword Test as it displays an example when using a script in the document

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    This is a web application running in Chrome? What version of Chrome are you using? What is your keyword test doing or what keyword test is causing "Object cannot be found"?

    • mdragani's avatar
      mdragani
      Occasional Contributor

      Yes it is Chrome. (sorry). When i went into Help|About to check it actually did an update to Version 109.0.5414.119 (Official Build) (64-bit). I know SmartBear recommends not doing automatic updates but had no choose. 

       

      I have several keyword tests. One is a simple login in to the our web product which validates with a check the page it is in.  Another is adding a user to our application.  Another is testing an invalid password then another invalid username.  The confusing thing is the keyword tests work and then for some reason when running another time it can't find the object (which is a number of different objects like a page, a click, url etc.  see below two examples below

       

      Unable to navigate to the http://localhost/corretrak page. 8:52:29 41.34

       

    • mdragani's avatar
      mdragani
      Occasional Contributor

      Thank you Alex..I will take a look at this

       

  • mdragani's avatar
    mdragani
    Occasional Contributor

    I am still struggling with getting errors in like about 60 Keyword Tests that were working fine and not erroring.  Yesterday I unsinstalled the software package I was testing where all the Keyword test completed without throwing errors.  The developer had rebuilt the components  using AdvanceInstaller (we were using a trial version prior to this) and that is when the issue seemed to resurface.  I had changed the 'Update Name Mapping a during test run' and that has significantly helped.  But now in all the keyword tests i am getting errors in my key test logs like below. I don't understand why the object keep becoming missing from the Name Mapping and don't want to have to rebuild all these keyword tests again.  Any help would be appreciated.

     

    still struggling with 

    • Marsha_R's avatar
      Marsha_R
      Moderator

      Pick an object that has this error and let's take a look at the existing name mapping and compare it to what Object Spy shows now. Post an example of this for us so we can take a look.

      • mdragani's avatar
        mdragani
        Occasional Contributor
        Marsha, thank you so much for looking at this. Please let me know if I didn’t get you everything you needed.
        I included the Actual object error from the Keyword Log(details tab),the Actual Object error from the Keyword Log(Picture tab), the Name Mapping associated with the Object BrowserWindow and the Object Browser associated with the Browser window. As I said before this was all working fine for like 40-50 keyword tests I had implemented over the last month and now they are erroring
        Sent from Mail<> for Windows
  • rraghvani's avatar
    rraghvani
    Champion Level 3

    Looking at what you have posted, you have the following mapped object

    Which is different to this,

    Which mapped object are you supposed to be using, Aliases.browser.BrowserWindow or Aliases.browser2.BrowserWindow ?

     

     

    My mapped object are structured like this,

    The last three items (pageFakeOneplace, pageOneplace and pageSignInToYourAccount) are the log in pages, which have unique URL's. Once I've logged in, I'm then redirected to pageAssetLiabilitySuite. This is the main website that has all the pages defined, e.g.

     

     

  • mdragani's avatar
    mdragani
    Occasional Contributor

    The Aliases.Browser2.BrowserWindow is the one that is WORKING.  I don't know why there are two. I have tried to physically change Browser to Browser2 in the actual Keyword tests that are failing but i cannot get that to work. So i just started re-recording the Keyword Tests. Is there a way to get all the Keyword tests that are failing to use Browser2 without re-recording them??

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    You need to change the value of this,

    If you re-record you might end up creating Browser3, Browser4 etc. I suggest you first organise your name mappings, use appropriate properties, and structure them correctly.

     

    I only Mapping Objects Manually for the controls I interact with only. It is time consuming building mapped objects, especially as I'm scripting (no keyword testing), but it works great.

    • Marsha_R's avatar
      Marsha_R
      Moderator

      I agree about mapping manually. The automatic mapping is sort of like the recording of tests. You can use the automatic process to get started but you really need to get in and adjust it manually so it works for your particular case. 

       

      We start with the manual mapping as well and build it out the way we like and then use automatic updating sparingly when the tests are stable.

    • mdragani's avatar
      mdragani
      Occasional Contributor

      I guess i am under clear how to map manually.  I cannot drag the objects from browser to browser2 can i in mapping? I am obviously not strong at scripting so that is why i use the record feature. So basically i should only have ONE mapping for each Object? Is that the idea?