Forum Discussion

nish_b's avatar
nish_b
Contributor
6 years ago

Passing parameters from Organize Tests to test script

Hi,   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...
  • RUDOLF_BOTHMA's avatar
    RUDOLF_BOTHMA
    6 years ago

    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

     

    Browsers.Item(browsername,url).Run();

    with

    return Browsers.Items(browsername,url);

     

    Then in your calling function, rather than

    StartBrowser('edge','www.mywebsite.com');

    do:

    var newBrowser = StartBrowser('edge','www.mywebsite.com');

    newBrowser.Run();

  • RUDOLF_BOTHMA's avatar
    RUDOLF_BOTHMA
    6 years ago

    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