Forum Discussion

aa1's avatar
aa1
Contributor
5 years ago
Solved

save HTML without content

Hi,

 

I have a function that is used to save the HTML tags of a webpage into a folder which can be treated as expected result and can be compared to the actual result during run time. The code works fine but it saves all the content in the controls as well. For example I do not want to save the value that is entered into a text box but only want to save the HTML details that specifies that there is a text box there. Is this even possible with testcomplete? How do I do that?

 

My code:

 

 

if(!ProjectSuite.Variables.generateHTML) return false; 
var folder = "";
ProjectSuite.Variables.generateHTML === "E" ? folder = "ExpectedResults\\" + folderName : folder = "ActualResults\\" + folderName; 
var filePath = ProjectSuite.Path + folder;

if(!createFolder(filePath)) return false; 
Sys.Desktop.Keys("^s"); 
Browsers.CurrentBrowser;
var browser = Aliases.browser; 

var fileNameBox = browser.Item.Item.Item.FloatNotifySink.ComboBox.Edit.wText;
if(typeof fileName === "undefined") fileName = fileNameBox; 
if(aqString.Find(fileName, ".html") == -1) fileName += ".html"; 
aqFileSystem.DeleteFile(filePath + "\\" + fileName);
var newFileName = fileName; 
browser.Item.Item.Item.FloatNotifySink.ComboBox.Edit.SetText(filePath + "\\" + newFileName);
browser.Item.btnSave.Click(); 

Please help.

 

thanks

aa

 

  • Do a "Web Comparision Checkpoint" and use the "Compare only Tag Structure feature.

    Cheers

    -Lino

2 Replies

  • LinoTadros's avatar
    LinoTadros
    Community Hero

    Do a "Web Comparision Checkpoint" and use the "Compare only Tag Structure feature.

    Cheers

    -Lino

    • aa1's avatar
      aa1
      Contributor

      Hi LinoTadros ,

       

      Thank you for the pointer. I will try it out. I need to have a script for it. I am assuming I will record the process to a script and using it should work for me.

       

      thanks again.