Forum Discussion

rrubio's avatar
rrubio
Contributor
11 years ago
Solved

unable to get .xml file contents displayed in web browser

Hi all,



I am using TestComplete 9.31 and I need to get xml content displayed in my browser (IE9.0, FF17), but when spying the object I can not.



Could anybody help me?



Thanks a lot.



Regards,



Rarul




  • Hi Rarul,


     


    Do you want to get the content of the loaded web page? If you do, there are many ways to do this. For example you can use the following code for this:


    Sys.Browser("iexplore").Page("*").contentDocument.body


     

3 Replies

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Rarul,


     


    Do you want to get the content of the loaded web page? If you do, there are many ways to do this. For example you can use the following code for this:


    Sys.Browser("iexplore").Page("*").contentDocument.body


     

  • Hi Tanya,





    thanks for the answer, but it is not working.

    Do you have another proposal?



    Thanks,



    Raul
  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Raul,


     


    What about the following code:


     




    function Test()


    {



     


      var xmlDoc = new ActiveXObject("Msxml2.DOMDocument");


      xmlDoc.async = false;


      xmlDoc.load(strUrl);


     


      var error = xmlDoc.parseError;


      if (error.errorCode != 0)


      {


         Log.Message(error.reason);


      }


      else


      {


         Log.Message (xmlDoc.xml);


      }


    }