To create a new document, you will have to add a new document to the word application. The very first thing which would be required is to create a new document or open an existing document. Refer MSDN Library – Microsoft Word Object Model for a complete list of methods and properties of Word Object. Now we can manipulate a Word document using different methods and properties of Word object. Set oWord = CreateObject("Word.Application") So our very first statement will be to get the object reference using CreateObject. We use set statement to assign the object reference to a variable. RemoteServerName is used to create the object on a remote server.įor word documents the application or the automation server is “Word” and the possible class for which we would like to create the objects for a Word Document would be Application. TypeName is the type or class of object to be created. ServerName is the name of application that provides the object or the application which provides Com interface. CreateObject(ServerName.TypeName, RemoteServerName) ![]() It accepts two arguments one mandatory and another optional. You can find many similar threads discussed there.Īutomating a Word in QTP is not very hard, you must be aware that we can use CreateObject Method to create an instance of a COM component. These are just a few there could be many reasons for this depending on your testing requirement like you can see at our QTP forums, there are lots of questions asked on automating word for different reasons – Replace a string in a document with another string ,Can QTP compare two MS Word Documents ,How to compare two Word Documents. The test script requires outputting a test log in word format. The test needs to take some input data from the Word document. The Application under test produces some kind of output in word document and testing need to verify it Let us first understand why one would need to deal with Word documents in the test scripts. Read the whole article and you will be familiar of using Word and it is quite similar and will be easier for you to work with excel as well. If you are already using Excel in your tests it will be quite easier for you, if not, nothing to worry, and both are similar except of some methods and properties. This article focuses mainly on automating Word in QTP. You can refer earlier posts by Ankur for Excel and QTP Part 1, Part2, Part3 for using Excel sheet. If you are an experienced QTP user, you can probably mange it do whenever you need. or using the instance of COM component to deal with an external excel sheet. It could be either using QTP methods like Import sheet, Import, Export etc. Many of us are familiar with the concept of using Excel Sheets in our tests. ![]() WORD DOCUMENTS OPEN BLANK SERIESA new three part series on Automating Word Documents with QTP by Saket Kumar.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |