QTP面試題:如何用QTP打開word并錄入內(nèi)容
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
沒有一個現(xiàn)成的方法來刪除cookies, 所以你需要寫一個Shell Script去刪除你的Cookie所在目錄的所有文件。實現(xiàn)的代碼如下:
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)