Ask a Question

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

apereira
New Contributor

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 1
Marsha_R
Champion Level 2

You have to build a string something like this

 

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

 

where n is the full object name of your variable

cancel
Showing results for 
Search instead for 
Did you mean: