1

My requirement is to execute the UFT scripts based on the input given in html page. I came to know from some of the blogs that Microsoft has stopped vbs script usage in html. for that reason i want to invoke the qtp scripts using java script. I searched for the same and didnt find much information. If anyone can provide the equivalent code in javascript will be helpful. I am in short of time to experiment as the client demo is near.

Dim objQtpApp
Set objQtpApp=Createobject("QuickTest.Application")
objQtpApp.Launch
objQtpApp.Visible=False 'True
varUserName=document.getElementsByName('Username').value
varPassword=document.getElementsByName('Password').value



call QC_Connect(varUserName,varPassword)

Sub QC_Connect(varUserName,varPassword,varCustomsON)

'   
    objQtpApp.TDConnection.Connect "http://dddd.fed.test.com:7117/qcbin", "Domain", "Project", varUserName, varPassword,False

    If objQtpApp.TDConnection.IsConnected Then

            objQtpApp.Open "[QualityCenter] Subject\Automated Test Case Development\Test",False  
            objQtpApp.Test.Environment.Value("varUserName")=varUserName
            objQtpApp.Test.Environment.Value("varPassword")=varPassword
            objQtpApp.Test.Environment.Value("varCustomsON")=varCustomsON
            objQtpApp.Test.Run
            objQtpApp.Quit


    Else
        MsgBox "Cannot connect to Quality Center"
    End If
End Sub

Thanks, Rakesh

1 Answers1

2

Your main problem will be that JavaScript doesn't have an equivalent of CreateObject.

The only browser that supports Microsoft's alternative (new ActiveXObject("...")) is IE (not Edge) and it also supports VBScript so there's no point in porting your code to JavaScript.

Community
  • 1
  • 1
Motti
  • 110,860
  • 49
  • 189
  • 262