Passing parameters from Organize Tests to test script
How to pass parameters from a script test using Parameters column present in Organize Tests view and then read that value within the test script?
For example: I want to pass paramenters like browser value (such as Edge) and read this value into a variable within my test script and launch the specified browser accordingly.
Is this possible? If yes, please explain how? Thanks!
I must be honest and say that I don't quite understand how that is not addressed by the initial code I posted. Perhaps you are trying to return the browser as an object from another script call ? In that case, replace
Then in your calling function, rather than
var newBrowser = StartBrowser('edge','www.mywebsite.com');
You can use a function in script with a parameter/mutiple parameters. Create the function in the initial post. Now drag that script unit into your window. All the functions in your script will be added. Remove the ones you don't want, then update the parameters as required - just like setting in in a KWT. Alternatively, add new test item. Click elipses in the test column and select the script. This process looks the same as "Run Script" from within a KWT