Forum Discussion

apereira's avatar
apereira
New Contributor
2 years 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

  • You have to build a string something like this

     

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

     

    where n is the full object name of your variable