Forum Discussion

kmathur's avatar
kmathur
Occasional Contributor
7 years ago

Getting error "Object doesn't support this property or method" for method that's been executed befor

Hi 

 

Here is what I am having issue with. 

I have written a method called "openInViewer" which is in the same script. The method is called after every scenario so like times. It execute fine for the first time but from then on it throws error as "Object doesn't support this property or method" for that method. 

Here is a sample code 

 

// works fine 

exportService("KML",resultFile);
openInViewer(resultFile);

 

//Next line 

exportService("Shapefile",resultFile);
publishFSFromFile(itemURL,"Shapefile",resultFile);
openInViewer(resultFile); //Fails with the error

 

Thanks in advance for suggestions. 

 

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    We need to know a bit more about what's going on inside "openInViewer".  I'm guessing here, but I'm thinking that your error reported is being reported inside openInViewer and not in the other code, correct?  So... in order to help you debug openInViewer, we need to see that code.

     

     

    • kmathur's avatar
      kmathur
      Occasional Contributor

      Hi 

       

      Thanks for the reply. There is nothing wrong in the OpenInViewer code as it executes fine for the first time. 

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        kmathur wrote:

        Hi 

         

        Thanks for the reply. There is nothing wrong in the OpenInViewer code as it executes fine for the first time. 


        I think you're missing the point....  the point is that there is a method or property being called in OpenInViewer that is failing... We don't know what that is because we don't have the code.  While it executes fine the first time, obviously something that is going on in your test process is causing it to fail in subsequent times.  Without the code, all we can do is say, "Yup... that's an error."

         

        So...  screenshots of the "Additional Info" panel in the error log for the error message, full text of the message from the error log, code from openInViewer and the publish method, and any indication as to what line within openInViewer is generating the error.  The problem is not in TC... it's in your code... so we need your code and any relevant information to figure out what's wrong.

  • Well, your "works fine" example is not exactly like your "Next line" example, so we know there is something different happening.

     

    If you try commenting out the "publishFSFromFile" line and run the "Next line" example, does it work without giving the error?

    • kmathur's avatar
      kmathur
      Occasional Contributor

      Hi 

       

      So the original code is using publishFSFromFile method 5 times (I am using it to test different file types). The openInViewer() works fine for the first time and failing after that. I can re order the methods but it always works fine for the first time and then failing. 

      So here is the complete code 

       

      exportService("Shapefile",resultFile);
      publishFSFromFile(itemURL,"Shapefile",resultFile);
      openInViewer(resultFile);

       

      exportService("CSV file",resultFile);
      publishFSFromFile(itemURL,"CSV",resultFile)
      openInViewer(resultFile);

       

      exportService("FGDB",resultFile);
      publishFSFromFile(itemURL,"FGDB",resultFile)
      openInViewer(resultFile);

       

      exportService("GeoJson",resultFile);
      publishFSFromFile(itemURL,"GeoJSON",resultFile)
      openInViewer(resultFile);

       

      So the code works fine for "Shapefile" and fails after that. If I bring "CSV file" part before that, I will execute perfectly for that and fails for "Shapefile" 

       

       

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        So, again... what is going in on openInViewer?  What is going on in your publishFSFromFile? All we can see is the methods your executing...  the problem is probably something within one of those two methods or even both in some way... without the code, we can't help debug it.