Forum Discussion

Mathit's avatar
Mathit
Contributor
7 years ago

Regular expression in web object name with numeric value

I have a web object 

Sys.Browser("chrome").Page("*").Form("*").Panel(0).Panel(0)

How do i use regular expression or wild character for numeric values like Panel(0).  sometimes shows up as Panel(1)

4 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    I'm assuming you're not using NameMapping to identify your objects?  The reason I say that is that using NameMapping you can identify the panels by other things (like className, Caption, etc) rather than just the object identifier which won't be subject to the variability that you're noticing.

     

    Or, you could incorporate "FindChild" methodology in your automation so that, rather than using the long string, you'd do something like

     

    var page = Sys.Browser("chrome").Page("*")
    var form = page.Form("*")
    var firstPanel = form.FindChild(['ObjectType','className'], ['Panel', 'TitleDiv'], 1)
    var secondPanel = firstPanel.FindChild(['ObjectType','className'],['Panel','HeaderDiv'], 1)

    As far as I know, the Panel identifiers you can't (and shouldn't) wildcard since that could confuse a number of things.  I'd strongly recommend "FindChild" for your object identification if you're not going to use NameMapping.  Those you can more easily wildcard or build out better identification logic.

      • Mathit's avatar
        Mathit
        Contributor

        set page1 = Sys.Browser("chrome").Page("*").Panel(0).Panel(0).Panel(0).Section("content").Panel(1).Panel("applicantForm").Panel(0).Form("ttt").Panel(0).Panel(0).Panel(7).Panel(0).Panel(0)
        panelobj = page1.Child(0).Name
        set page2 = page1.panelobj

         

        Im using like the above to find the Panel name.  Here panelobj returns the correct name of the object.

        But page2 always returned as Non-existent object.  Is there a reason for this?