Silktest Question 9 : How to capture the contents of Microsoft Word document invoked in Internet Explorer browser.

The following code in 4test language will help to solve your problem with SilkTest and Microsoft Word.

[ ] STRING sSFileName="FileName"
[ ] STRING sTFileName="FileNameTarget"
[ ]
[-] window DialogBox DS
[ ] tag "{sSFileName} - Microsoft Word"
[ ]
[-] window DialogBox D1
[ ] tag "Document1 - Microsoft Word"
[ ]
[-] window DialogBox SaveAs
[ ] tag "Save As"
[ ] parent DS
[ ]
[-] window DialogBox Open
[ ] tag "Open"
[ ] parent D1
[ ]
[-] testcase Copy_Content_Of_Word_To_Notepad()
[ ] SYS_Execute("Start Winword.exe")
[ ] D1.SetActive()
[ ]
[ ] D1.TypeKeys("")
[ ] Open.TypeKeys("D:\{sSFileName}.doc")
[ ] Open.TypeKeys("-Word Document")
[ ] Open.TypeKeys("")
[ ] DS.SetActive()
[ ]
[ ] DS.TypeKeys("-a")
[ ] SaveAs.TypeKeys("-Text Only")
[ ] SaveAs.TypeKeys("D:\")
[ ] SaveAs.TypeKeys("")
[ ]
[ ] DS.DialogBox("Microsoft Word|$MessageBox").TypeKeys("")
[ ] DS.DialogBox("File Conversion - {sSFileName}").TypeKeys("")
[ ] DS.DialogBox("File Conversion - {sSFileName}").TypeKeys("")
[ ] DS.TypeKeys("-x")
[ ]

The 4test code will make an .txt file and you can read the content of this file and verify your data.

3 comments:

Anonymous said...

You can also, open the document, desktop type keys 'Ctrl-A' on the document and 'Ctrl-C' to the clipboard. Then using SilkTest clipboard functions, work with the data (put it in a list, etc). Good for one time data usage.

Anonymous said...

Have you had an experience working with Microsoft word documents? I need to test the content of a Word plugin/app that we use - I guess writing a utility (VB, C#, etc.) to do this is one way. Do you know of any other 'easier' way? The test requires capturing all components of the document (text, chart, table, excel objects) - and changing all components.

MB said...

How about VBA?

SilkTest interview questions for QA Testers