Forum Discussion

GielRaijmakers's avatar
GielRaijmakers
New Contributor
10 years ago

regex to find childobject

Hi all. 

I'm trying to find a childobject on a modal page. This modal page has a changing id.... 

 

I made a regex to find the page: 

 

regEx = """http://(\w*).(\w*).(\w*)/MP02ZoekArtikel\.tn\?window=modal&OpenedWithFrameworkUi=1&id=%7b([0-9a-fA-F-]+)%7d"""

 

The childobject is a FlexGrid. 

Set VSFlexGrid8L = sys.HighlightObject(Sys.Process("Framework.UI").WPFObject("HwndSource: PageViewerWindow", "Zoek Artikel").WinFormsObject("WinFormsAdapter", "").WinFormsObject("WebBrowserWithCustomInternetSecurityManager", "", 2).WinFormsObject("Shell Embedding", "").Window("Shell DocObject View", "", 1).Window("Internet Explorer_Server", "", 1).Page(regEx).Child(0).FindChild("WndClass","VSFlexGrid8L"))

 

I do know that I can't use Page(regEx), but... how can I use the regex to find that page??

 

Thanks. 

Giel 

    • GielRaijmakers's avatar
      GielRaijmakers
      New Contributor

      Thanks Ranya, 

      I will give it a try. 

      Kind of new at TestComplete, still got to find all the "buttons" to press. ;-) 

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi Giel,

     

    Assuming that there is one "Internet Explorer_Server" object in the tested application, why not to use the FindChild() functions provided by TestComplete? I.e. something like this (untested, off top of my head):

     

    Set oIEWin = Sys.Process("Framework.UI").FindChild("WndClass", "Internet Explorer_Server", 20)

    Set oPage = oIEWin.Page(*)

    Set oGrid = oPage.FindChild("WndClass", "VSFlexGrid8L", 20)

     

    I think that this is more reliable, simpler and clear than complex RegExp...

    • GielRaijmakers's avatar
      GielRaijmakers
      New Contributor

      Hi Alex, 

      agree. 

      It is also kind of how I did it eventually. 

       

      Thanks for the support!