Using a variable in the code is not working the same as putting in the exact webpage
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Using a variable in the code is not working the same as putting in the exact webpage
I have an input file that holds all the data I need for my tests. This allows the user to update as needed and still be able to run the tests. I also want to be able to use this file to select the environment to run the tests. Since it is a webpage, I figured I could just replace the address with the variable and it would work the same. I am not finding this to be the case. The first problem I am running into is that it isn't recognizing the .Wait functionality that I absolutely need.
These fail
var testenvironment = getTestCase("environment").Entered;
testenvironment = "Aliases.browser." + testenvironment;
testenvironment.Wait(10000);
var testenvironment = getTestCase("environment").Entered;
Aliases.browser.testenvironment.Wait(10000);
But this works
Aliases.browser.NameMappedWebPageCom.Wait(10000);
I don't understand why it fails. If I can't get this simple statement to work, I don't want to waste my time changing all of my scripts, but being able to just feed in the environment would be fantastic
Thanks
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What you have in the testenvironment variable is a string and you need it to be an object.
In vbscript I would use
set testenvironment = "Aliases.browser." + testenvironment
or maybe
testenvironment = eval("Aliases.browser." + testenvironment)
Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the response!
That's what my developer said, too.
For JScript, it looks like this
Aliases.browser[testenvironment].Wait(1000);
