cancel
Showing results for 
Search instead for 
Did you mean: 

inner html

Highlighted
Contributor

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

Tags (1)
6 REPLIES 6
Community Hero

Re: inner html

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


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
Contributor

Re: inner html

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.

Community Hero

Re: inner html

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


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
Community Manager

Re: inner html

HI @bistritapcv,

Did Tristaanogre's suggestion help?

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
Occasional Contributor

Re: inner html

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;

 

Community Hero

Re: inner html

> 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.

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Postings made by [Community Expert Group] members
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
New Here?
Join us and watch the welcome video:
API Testing Mistake #2
APITestingMistake#2
Top Kudoed Authors