UFT AOM using JavaScript

Hi Team,

Not sure, whether this can be done.

I have developed a webpage with radio group buttons for test cases as flag values and Execute test case button.

On clicking the Execute test case button from the webpage, Im able to connect UFT, using java script. 

On Running the script:   The problem is when i click on the Execute test case button, the webpage becomes hold /inactive, since its loading uft scripts for execution. But i want to access the radio button from the same webpage, which have the flag value set. So that i can execute particular function from the uft script.

Any idea..  Please help...

 

Thanks,

Sarath

 

 

Parents
  • Are you running the UFT script on the same machine? Is the application that you test a web based application?

  • Yes running on the same machine.

    The application I test is not web based application.

    Please find the attached webpage. On clicking on the execute test case button from the webpage.. Its launching the uft. then using uft script im not able to access the radio button TC1,TC2,TC3.... 

    Below is the javascript which launches UFT and runs the action, when i click the execute test case button.

    function OpenQTP(TestScript)

    {

    var App = new ActiveXObject("QuickTest.Application"); // Create the application object

    App.Launch(); // Start QuickTest

    App.Visible = true // Make it visible

    App.Open = TestScript

    App.Test.RunAction = "xxxxxxxx"

    App.Quit(); 

    }

     UFT Script

    It stucks in the below line.. its waiting for the object from the webpage...

    If Browser("").Page("").WebRadioGroup("Flag").GetROProperty("selected item index") = "1"  then

    End if

  • Guess the issue here is related to when you are opening UFT/Browser. The pre-requisite for Browsers is that the Browser should be opened after UFT, so that UFT can hook into it.

    Can you try changing the approach?

    For example, Read the values from the Web page using JavaScript and pass them to the test as Parameters.

  • Thanks for your valuable idea.

    Similarly any suggestion, how to pass the back value to the webpage from UFT. I need to print the test result in the webpage, after execution is over. I can get the handle of the webpage, only after closing UFT.

  • Thanks for your valuable idea.

    Similarly any suggestion, how to pass the back value to the webpage from UFT. I need to print the test result in the webpage, after execution is over. I can get the handle of the webpage, only after closing UFT.

  • Here's an idea. Write the result to a Text file from UFT. After the test has finished, read this text file from javascript & update the page.

  • I got the value from the webpage and stored in a variable. But its not setting into testparameters in UFT.

       var App = new ActiveXObject("QuickTest.Application"); // Create the application object
      App.Launch(); // Start QuickTest
      App.Visible = true // Make it visible
      App.Open = TestScript
      
      var rtParams = App.Test.ParameterDefinitions.GetParameters();
      var ParamName = "ENV"
      rtParams.Item(ParamName).Value = "UAT"
      App.Test.RunAction = "XXXXXXX"
      App.Quit();


    Its running the action, on this line Msgbox TestArgs("ENV") in UFT, Im getting empty message box.  :(

    Kindly help

     

  • I got the value from the webpage and stored in a variable. But its not setting into testparameters in UFT.

       var App = new ActiveXObject("QuickTest.Application"); // Create the application object
      App.Launch(); // Start QuickTest
      App.Visible = true // Make it visible
      App.Open = TestScript
      
      var rtParams = App.Test.ParameterDefinitions.GetParameters();
      var ParamName = "ENV"
      rtParams.Item(ParamName).Value = "UAT"
      App.Test.RunAction = "XXXXXXX"
      App.Quit();


    Its running the action, on this line Msgbox TestArgs("ENV") in UFT, Im getting empty message box.  :(

    Kindly help

     

  • I got the value from the webpage and stored in a variable. But its not setting into testparameters in UFT.

       var App = new ActiveXObject("QuickTest.Application"); // Create the application object
      App.Launch(); // Start QuickTest
      App.Visible = true // Make it visible
      App.Open = TestScript
      
      var rtParams = App.Test.ParameterDefinitions.GetParameters();
      var ParamName = "ENV"
      rtParams.Item(ParamName).Value = "UAT"
      App.Test.RunAction = "XXXXXXX"
      App.Quit();


    Its running the action, on this line Msgbox TestArgs("ENV") in UFT, Im getting empty message box.  :(

    Kindly help

     

Reply
  • I got the value from the webpage and stored in a variable. But its not setting into testparameters in UFT.

       var App = new ActiveXObject("QuickTest.Application"); // Create the application object
      App.Launch(); // Start QuickTest
      App.Visible = true // Make it visible
      App.Open = TestScript
      
      var rtParams = App.Test.ParameterDefinitions.GetParameters();
      var ParamName = "ENV"
      rtParams.Item(ParamName).Value = "UAT"
      App.Test.RunAction = "XXXXXXX"
      App.Quit();


    Its running the action, on this line Msgbox TestArgs("ENV") in UFT, Im getting empty message box.  :(

    Kindly help

     

Children