Forum Discussion

philip_webb's avatar
philip_webb
New Contributor
10 years ago
Solved

Alternatives to ClipBoard Checkpoint

Hi, I'm wondering if there is a similar or alternative function for comparing Clipboard data or data in an open Excel spreadsheet.



I am trying to verify the contents of an opened excel spreadsheet, when it opens the content to be verified is highlighted automatically.  I tried verifying this by copying the data to the clipboard, but with the pre-packaged clipboard checkpoint if there is too much data on the clipboard the checkpoint always fails, and posts these errors to the log:



An error occurred while creating a regular expression.

Possible reason: the regular expression is incorrect.



I then tried verifying by saving the excel file to disk and using a File Checkpoint.  I cannot speak for other file types but for excel files there can be up to 15% file difference even when the content and name of the two excel files are identical.  Further to this, the integrity of the baseline excel file seems to degrade over time.  A checkpoint that results in 2% file difference today could give a 70% file difference tomorrow, or even 100%.  I realise there is always some variable data stored but in spite of my efforts I cannot guarantee a baseline captured today will not give a 100% difference in a checkpoint ran tomorrow.



If anyone has any insight as to where I'm going wrong with the checkpoints or knows a better way to verify data in an open excel spreadsheet I would appreciate the help.



Thanks

Philip





3 Replies

  • marin's avatar
    marin
    Frequent Contributor


    Hello Philip,



    judging by the message (regular expression problem)  I'd say that there could be something wrong with the checkpoint definition.



    You might try to use this to verify if data in your clipboard contains the expected value:





    //Capturing entire contents of document into clipboard (CTRL + A, CTRL + S)

    //and converting the variant into string, then searching the content for desired substring



    yourExcelObjectPage.Keys("^a^c");


    var clip = aqConvert.VarToStr(Sys.Clipboard);

    var chkText = aqString.Find(clip, "ABC");


     

    //searching for "ABC" in clipboard

    if (chkText < 0)

    {


      Log.Error("Text ABC is not displayed on Excel sheet.")

    }


    else

    {

      Log.Checkpoint("Text ABC is displayed on Excel sheet.")

    }






    Hope this helps,



    Marin