Automation 使用UFT的无头UI自动化测试

Automation 使用UFT的无头UI自动化测试,automation,hp-uft,ui-testing,headless-browser,Automation,Hp Uft,Ui Testing,Headless Browser,是否有一种方法可以使用无头浏览器在UFT中运行我们的自动化脚本,类似于我们使用selenium所做的 我现在运行的脚本占用了很多时间,而且速度非常慢 我对UFT比较陌生,使用UFT对web w.r.t无头测试进行了一些研究,但没有找到任何结果 任何提示或建议都将不胜感激。您是否与下面的代码相似 Public Function GetAllLinksInthePage() Dim oIE Set oIE = CreateObject("InternetExplorer.Applic

是否有一种方法可以使用无头浏览器在UFT中运行我们的自动化脚本,类似于我们使用selenium所做的

我现在运行的脚本占用了很多时间,而且速度非常慢

我对UFT比较陌生,使用UFT对web w.r.t无头测试进行了一些研究,但没有找到任何结果


任何提示或建议都将不胜感激。

您是否与下面的代码相似

Public Function GetAllLinksInthePage()
    Dim oIE
    Set oIE = CreateObject("InternetExplorer.Application")
    oIE.Visible = False
    oIE.Navigate2 "http://newtours.demoaut.com/"
    Wait 4
    Set oIEDocument = oIE.Document
    Set oLinkCollection = oIEDocument.getElementsByTagName("A")
    iLinkCount = oLinkCollection.Length
    If iLinkCount > 0 Then
        For iCount = 0 To iLinkCount - 1
            Print oLinkCollection(iCount).Text
        Next
    End If  
    Set oIE = Nothing
End Function

你看起来像下面的代码吗

Public Function GetAllLinksInthePage()
    Dim oIE
    Set oIE = CreateObject("InternetExplorer.Application")
    oIE.Visible = False
    oIE.Navigate2 "http://newtours.demoaut.com/"
    Wait 4
    Set oIEDocument = oIE.Document
    Set oLinkCollection = oIEDocument.getElementsByTagName("A")
    iLinkCount = oLinkCollection.Length
    If iLinkCount > 0 Then
        For iCount = 0 To iLinkCount - 1
            Print oLinkCollection(iCount).Text
        Next
    End If  
    Set oIE = Nothing
End Function

若您的应用程序以REST或SOA的形式提供了丰富的API集,那个么您可以使用XMLHTTP对象。它独立于QTP/UFT。它是纯VBSSCcript,可以在任何地方使用。可悲的是,您必须从头开始编写大量代码,但这相当容易

dim xmlhttp、fso、f1、serverURL
设置xmlhttp=Createobject(“Microsoft.xmlhttp”)
服务器URL=”http://maps.googleapis.com/maps/api/distancematrix/xml?origins=Atlanta+GA+USA和目的地=达拉斯+TX+USA和单位=英制和传感器=假”
xmlhttp.Open“POST”,serverURL,false
xmlhttp.Send
设置fso=CreateObject(“Scripting.FileSystemObject”)
设置f1=fso.CreateTextFile(“D:\Sample VB Scripts\testfile.xml”,True)
f1.write xmlhttp.ResponseText

f1.关闭
如果应用程序以REST或SOA的形式提供丰富的API集,则可以使用XMLHTTP对象。它独立于QTP/UFT。它是纯VBSSCcript,可以在任何地方使用。可悲的是,您必须从头开始编写大量代码,但这相当容易

dim xmlhttp、fso、f1、serverURL
设置xmlhttp=Createobject(“Microsoft.xmlhttp”)
服务器URL=”http://maps.googleapis.com/maps/api/distancematrix/xml?origins=Atlanta+GA+USA和目的地=达拉斯+TX+USA和单位=英制和传感器=假”
xmlhttp.Open“POST”,serverURL,false
xmlhttp.Send
设置fso=CreateObject(“Scripting.FileSystemObject”)
设置f1=fso.CreateTextFile(“D:\Sample VB Scripts\testfile.xml”,True)
f1.write xmlhttp.ResponseText
f1.关闭