Ask a Question

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

Egg
Frequent Contributor

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

Hello,

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. 

3 REPLIES 3
Lee_M
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

AlexKaras
Champion Level 2

Hi,

 

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

 

Regards,
  /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.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
sonya_m
SmartBear Alumni (Retired)

Great advice, Community!

 

@Egg which suggestion did you end up using?


Sonya Mihaljova
Community and Education Specialist

cancel
Showing results for 
Search instead for 
Did you mean: