Forum Discussion

apereira's avatar
apereira
New Contributor
11 months ago

Is it possible to use a local variable in the object name?

Hi, I am trying to create a simple iterative web test taking elements from a list. But I cannot find documentation about how to use a variable in an object name.

 

For example, I want to replace the number 2 with the variable n in the following object name.

Aliases.browser.pageRegistration.FindElement("//tr[2]/td/a")

 

Thanks

1 Reply

  • Marsha_R's avatar
    Marsha_R
    Champion Level 3

    You have to build a string something like this

     

    "//tr["+n+"]/td/a"

     

    where n is the full object name of your variable