Skip navigation
Currently Being Moderated

Using regular expressions in "afpid"

Aug 30, 2010 1:09 PM

Hi -

 

I'm testing an XFA form with several sections that can be added or removed.  These sections are implemented using subform "rows" containing various widgets, so my test object tree might contain:

sfRow

     txtAmount

     ddlType

sfRow_2

     txtAmount

     ddlType

sfRow_3

     txtAmount

     ddlType

where sfRow's afpid/SOM expression could be:     xfa[0].form[0].form1[0].sfCalendar[0].sfWeek[0].sfRow[0]

 

I would like to use a regular expression for the afpid property for the test object "sfRow" (and its children) so that I do not need to maintain sfRow_2 and other siblings, then use an alternate way (such as an index ordinal) to find the unique row or widget I'm interested in.

 

But as soon as I set the Test Object property "afpid" to any regular expression (apart from its original unescaped text), the object fails to match, eg. Highlight in application yields:

    The selected object could not be highlighted.

 

In fact, some regular expressions, eg ".*sfRow\[\d\]" seem to cause my AcroQTP server (Adobe Reader) to enter a bad state and need restarting.

 

Why doesn't regular-expression matching work for afpid ?

Any suggestions how I can "collapse" all my row subforms?

 

- Brent

 
Replies
  • Currently Being Moderated
    Sep 20, 2010 10:10 AM   in reply to Brent_2310242

    Hi Brad,

     

    Mike's request for help made it to me this morning.

     

    We fixed this back in March.  Which build are you using?

     

    Dave

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 21, 2010 9:10 AM   in reply to Brent_2310242

    I'm glad to hear that regexp matching is working for afpid!

     

    I don't think that I can help you with the other problem.  Perhaps you should start a dedicated thread for it.  I don't understand what you mean by "change the afpid on a "sfRow" element ... back to a regular expression."

     

    Dave

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 4, 2011 2:10 AM   in reply to Brent_2310242

    Thanks for your reply and keep sharing.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 26, 2011 4:13 PM   in reply to Brent_2310242

    I am having the same trouble.  Any help available?  I have written code to simulate the OR highlight function.  I use this code to investigate the OR recognition.  I am curious why explicite strings work but regular expressions do not.  Here is the code for my highlight routine.

     

    ' Declare APIs
    Extern.Declare micHwnd, "GetDesktopWindow", "User32.DLL", "GetDesktopWindow"
    Extern.Declare micULong, "GetWindowDC", "User32.DLL", "GetWindowDC", micHwnd
    Extern.Declare micInteger, "ReleaseDC", "User32.DLL", "ReleaseDC", micHwnd, micULong
    Extern.Declare micULong, "CreatePen", "Gdi32.DLL", "CreatePen", micInteger, micInteger, micDword
    Extern.Declare micInteger, "SetROP2", "Gdi32.DLL", "SetROP2", micULong, micInteger
    Extern.Declare micULong, "SelectObject", "Gdi32.DLL", "SelectObject", micULong, micULong
    Extern.Declare micULong, "DeleteObject", "Gdi32.DLL", "DeleteObject", micULong
    Extern.Declare micULong, "GetStockObject", "Gdi32.DLL", "GetStockObject", micInteger
    Extern.Declare micULong, "Rectangle", "Gdi32.DLL", "Rectangle", micULong, micInteger, micInteger, micInteger, micInteger

    Public Sub Highlight (Obj, Times)

       ' Get screen coordinates
       X = eval(Obj.GetROProperty ("abs_x") )
       Y = eval(Obj.GetROProperty ("abs_y") )
       W = eval(Obj.GetROProperty ("width") )
       H = eval(Obj.GetROProperty ("height") )

       ' Get Desktop DC
       hDC = Extern.GetWindowDC (Extern.GetDesktopWindow)
       ' Create a three pixels wide Pen
       hPen = Extern.CreatePen (6, 3, RGB(0, 0, 0)) ' PS_INSIDEFRAME, 3 , RGB(0, 0, 0)
       Extern.SetROP2 hDC, 6 ' hDC, R2_NOT
       Extern.SelectObject hDC, hPen
       ' Use an empty fill
       Extern.SelectObject hDC, Extern.GetStockObject (5) ' NULL_BRUSH

       ' Execute
       'msgbox X & ", " & Y & ", " & W & ", " & H,,"X, Y, W, H"
       for i = 0 to Times * 2 + 1
          Extern.Rectangle hDC, X, Y,X+W, Y+H
          wait 0, 100
       Next

       ' CleanUp
       Extern.ReleaseDC Extern.GetDesktopWindow, hDC
       Extern.DeleteObject hPen

    End Sub

    ...

    ...

    Highlight Window("Windows Internet Explorer").WinObject("Shell DocObject View").PDFDoc("PDF").AcroXFAForm("form").AcroXFAForm("coventryHealthc are").AcroXFAForm("page1").AcroXFAForm("sGHPMOHealthQuestionaire"), 15    'works because it references stored object in OR


    Highlight Window("Windows Internet Explorer").WinObject("Shell DocObject View").PDFDoc("PDF").AcroXFAForm("form").AcroXFAForm("coventryHealthc are").AcroXFAForm("page1").AcroXFAForm("name:=sGHPMOHealthQuestionnair e","afptype:=subform","afpid:=xfa[0].form[0].coventryHealthcare[0].pag e1[0].sGHPMOHealthQuestionnaire[0]"),15     'doesn't work.  Actually removes recognition.  'Breaks' Object Spy  Why?

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points