Forum Discussion

olga_ulchina's avatar
olga_ulchina
Occasional Contributor
10 years ago
Solved

How to return object's mapped name (vbscript)

I mapped an element on a webpage, lets say it's Aliases.browser.page.button. In my script I have a function which checks if this element is present on page. Something like: Function IsPre...
  • HKosova's avatar
    10 years ago
    Hi Olga,



    A possible solution is to change IsPresent to accept the object name as a string. You can convert a string to an object using Eval.



    IsPresent("Aliases.browser.page.button")





    Function IsPresent(AliasStr)

      Dim element

      Set element = Eval(AliasStr)

      ...



      ' In case it does not exist log its name

      Log.Error AliasStr

    End Function