Is it possible to use a local variable in the object name?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2023
11:17 AM
05-23-2023
11:17 AM
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
Labels:
1 REPLY 1
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2023
11:29 AM
05-23-2023
11:29 AM
You have to build a string something like this
"//tr["+n+"]/td/a"
where n is the full object name of your variable
