Forum Discussion

secloreqa's avatar
secloreqa
New Contributor
9 years ago

Unable to find the content of Word Document using Object Spy in test Complete

I am trying to add a validation point in my Test Script using the Content of File Document.

So,for making sure the file has opened successfully,I want to check the content of the file against the base initial Text,but I am not able to get any property for the same,

 

Object Spy is not able to identify the Document Content.

Also office Controls are not being identified by the spy.

Please let me know if there is something which I am missing.

6 Replies

    • secloreqa's avatar
      secloreqa
      New Contributor

      This is the last thing which I would try..

      At the start of the evaluation I don't want to perform programming however it's the most reliable and robust solution.

      Also,for my Test environment,the script is not running as it's disabling my Word Plugin and hence issues..

  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)

    secloreqa wrote:

    I am trying to add a validation point in my Test Script using the Content of File Document.

    So,for making sure the file has opened successfully, I want to check the content of the file against the base initial Text


    There's an extension for TestComplete to compare Word files; you can download it here:

    http://support.smartbear.com/viewarticle/17635/

     

    Copy this extension to <TestComplete>\Bin\Extensions\ScriptExtensions, and then you can use this code:

     

    WordDocs.Compare(file1path, file2path, 1);

    For details and parameters, see this article: Compare Word files.

     

     

    If you need just to read a Word file (and not compare 2 files), you can use the Word COM object, Word.Application. Here's an example:

    // JScript

    // Open a file in Word
    var oWord = Sys.OleObject("Word.Application"); oWord.Visible = true; var oDoc = oWord.Documents.Open("C:\\Test.doc"); // Read the paragraphs one by one, and post them to the log for (var i = 1; i <= oDoc.Paragraphs.Count; i++) { Log.Message(oDoc.Paragraphs.Item(i).Range.Text); } oDoc.Close();
  • Hi,

     

    Please Activate MSAA and Text Recognition in Project Properties Then Try with object spy it may work

     

    Thanks

    Kamal

    • secloreqa's avatar
      secloreqa
      New Contributor

      I tried these options, MSAA was already selected,I just selected * which was unselected ,now atleast test Complete is able to identify the Commandbar controls,

      For Text Recognition it's asking to add Window,so is this window generic.if I have to recognise text of Word Document,which window should I add .Also will this work even of another Word document is opened.? 

      • Kamal_chennai's avatar
        Kamal_chennai
        Contributor

        Hi 

         

        You can Add Text Recognition for Generic window like add * in Text Recognition panel after that you can try with Object Spy

         

        Thanks

        Kamal