How to get the HTML for the current page
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2017
02:09 PM
12-27-2017
02:09 PM
How to get the HTML for the current page
In JScript, how do I retrieve the entire HTML (as a text string) of the current page? I assume it's some property or method off of page.contentDocument, but I can't find anything that seems to give me the entire document.
I want to include the HTML of my page in the body of a REST API call to a service that validates the HTML.
Solved! Go to Solution.
1 REPLY 1
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2017
03:20 PM
12-27-2017
03:20 PM
Ha! Figured it out. Thanks to this SO post, an answer that works in TestComplete is:
var page = Sys.Browser().Page("*");
var html = '<!DOCTYPE HTML>' + page.contentDocument.documentElement.outerHTML;
