Ask a Question

I want to save the web page's text using keyword test.

Frequent Contributor

I want to save the web page's text using keyword test.


Can I save web page's any text to Test complete's variable using Keyword test ? 

How can I do that?


Finally, I wanna receive text on the web page. and compare my text with received text on the web page. 

and then put out log messege. 

Community Hero

@Egg, what do you mean by any text - are you talking about webpages?


Is this a component called 'any text' or a specific component defined at runtime or ALL text on the page?


One approach to this issue would be accessing the DOM the NativeWebObject or the contentDocument these give you cirect access to the page DOM which can then be manipulated with regex

- Scripting (code snippet) only


e.g. (untested codes)

pagetext = Sys.Browser().Page("*").contentDocument.textContent

allDOM = Sys.Browser().Page("*").contentDocument.all

Champion Level 2



Alternatively to what was suggested by @Lee_M, you may consider to use .text/.wText/.value property of page object. (Check using Object Browser what property exists and contains plain page text.)


  /Alex [Community Champion]
[Community Champions] 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. Posts made by [Community Champions]
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.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
SmartBear Alumni (Retired)

Great advice, Community!


@Egg which suggestion did you end up using?

Sonya Mihaljova
Community and Education Specialist

Showing results for 
Search instead for 
Did you mean: