hao_bai
15 years agoOccasional Contributor
Why testComplete can't replace string in htm file?
I want save or modify specified htm file after replace the string with "#FFFF99" to "#FFFFFF". Scripts as follows
===== VBScript Begin=======
In VBScript:
sub Comp_Refile()
Dim file1,fileText1, newText1
' Reads the first text file
Set file1 = aqFile.OpenTextFile("C:\Temp\p2.htm",12,22)
fileText1 = file1.ReadAll
Log.Message(fileText1)
newText1 = Replace(fileText1, "#FFFF99", "#FFFFFF")
lala = aqFile.WriteToTextFile("C:\Temp\p2_2.htm", newText1, 22, Yes)
file1.Close
end sub
====== VBScript end======
1. If the htm file is small size like a1.htm, script will running success,
2. But when the file P2.htm size is 163KB, the TC can't log.message of fileText1, See pic Log.1.JPG,
3. And TC can't save modified file p2_2.htm successfully, it only log "<"
TCRP.zip contained the a1.htm P2.htm and other files.
How can I deal with P2.htm in TC7.5?