QTP面试题:如何用QTP打开word并录入内容
Set wobj = CreateObject(”Word.Application”)
wobj.Visible = True
Set Doc = wobj.Documents.Add
Set Range = Doc.Paragraphs.Add.Range
Range.Text = “The first Paragraph”
Doc.Paragraphs.Add
Set Range2 = Doc.Paragraphs.Add.Range
Range2.Text = “The second Paragraph”
QTP面试题:如何通过脚本来删除cookies
没有一个现成的方法来删除cookies, 所以你需要写一个Shell Script去删除你的Cookie所在目录的所有文件。实现的代码如下:
Const COOKIES = &H21&
Set objShell = CreateObject(“Shell.Application”)
Set objFolder = objShell.Namespace(COOKIES)
Set objFolderItem = objFolder.Self
strPath = objFolderItem.Path & “\*.*”
Set objFSO = CreateObject(“Scripting.FileSystemObject”)
objFSO.DeleteFile(strPath)