Forum Discussion

fayrehouse's avatar
fayrehouse
Frequent Contributor
12 years ago

Control identification property other than ObjectIdentifier

Hi All,



When I record a script, I get a line such as:



Sys.Browser().Page(******).Frame(******).Form(******).Panel("navigation").Link(0).Click();



The "navigation" of the Panel object, and the "0" of the Link are, in both cases, the ObjectIdentifier. However, the Label also has "contentText" that is infinitely more meaningful than "0".



Is there a way, without using the likes of Find Child to achieve something to the effect of



Sys.Browser().Page(******).Frame(******).Form(******).Panel("navigation").Link("My link text on screen").Click();







Cheers



Steve



  • fayrehouse's avatar
    fayrehouse
    Frequent Contributor
    Hi Alexei,



    Maybe I'm missing something still, but... I previously had auto name mapping turned off. To use templates, I had to turn mappng back on. I defined a template, and recorded a bit of our tested app functionality - clicking 2 links



    This produced 2 mapped link objects, and aliases for each, with code such as 



    Aliases.browser.frame.link2.Click();



    But:

    a) looking at this code, it's not immediately obvious which link "link2" is - anyone reading would need to flick between the code and the object map

    b) (most importantly here) - Im trying to write a function where I can specify the link label as a parameter, and the right link will be clicked eg:



    Function ClickLinkOnScreen(linktext)

    {

      Sys.Browser().Page(******).Frame(******).Form(******).Panel("navigation").Link(linktext).Click();

    }



    Called like:

    ClickLinkOnScreen("My Link Label");



    Or have I just not used the template mapping correctly?