Ask a Question

Using a variable in the code is not working the same as putting in the exact webpage


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;



var testenvironment = getTestCase("environment").Entered;




But this works




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



Community Hero

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)

[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.

Thanks for the response!

That's what my developer said, too.  


For JScript, it looks like this  


Showing results for 
Search instead for 
Did you mean: