Forum Discussion

bistritapcv's avatar
bistritapcv
Contributor
5 years ago

inner html

I am running a desktop operation, and it brings up an IE window.  So I would like to get text from the IE window.  I cannot do an inspect (F12) on it so I don't know all the fields, but I know for sure there is an html.  So I did a

 

var browser = Connect.Sys["Process"]("iexplore", 900000);
var html = browser["FindChildByXpath"](".//html");

 

I am not sure what to do to get the text.  These both compile and run, but they are either "var" object or "com" object.

Now that I (apparently) have the innerhtml, how do I get the text from it?

 

And to repeat this is a desktop test, which spawns an IE

6 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    First, in order for TestComplete to interact with web pages, even ones embedded in desktop apps, you need a web license.

     

    Assuming, first, you have that...  You can use Connect.Sys.Browser('iexplore').<page object>.innerText

    • bistritapcv's avatar
      bistritapcv
      Contributor

      I am sure we have a web license.

      I don't really know what the <page object> will be.

      But the url has "random=0.3334441223159447" or some other random number in it, so there is no way I would know what the URL is.  The page is already being displayed too, so I don't want to start a new session.

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        You should be able to, in your code, replace any dynamic/random values in the URL with the asterisk character to wildcard it.

  • ishan_07's avatar
    ishan_07
    Occasional Contributor

    Hello,
    You will get the HTML of the selected selector and you can also print on web page or in  log. Following is the HTML code for innerHTML.

    E.g.

    var x = document.getElementById("myP").innerHTML;

     

    • AlexKaras's avatar
      AlexKaras
      Champion Level 3

      > HTML of the selected selector

      TestComplete is not Selenium.

      While in general, your code might work in TestComplete as well, the case is how to get the reference to the document property in this given case.