Highlighted
Contributor.
Contributor.
2904 views

Type Command not working in UFT 12.00 but working in QTP 11

Hello,

 

We are automation a Terminal emulator and we are using Attachmate Extra Xtreme.

 

When I use "Type" command to send string or Key Strokes to emulator window,

 

It works fine with QTP 11 but not with UFT 12.00

 

If I use "SendKey" instead of "Type" ... it works in UFT 12.00.

Still UFT 12.00 is not consistent with "SendKey" Command.... Few places I need to use "Type"

 

Any help on this is appreciated.

 

 

Thanks.

0 Likes
1 Reply
Highlighted
Outstanding Contributor.
Outstanding Contributor.

Re: Type Command not working in UFT 12.00 but working in QTP 11

Hi Wfds,

 

Hope you are doing well.

 

My name is Ruddy and i want to help you in this issue, searching information i found the Terminal Emulator supported version and Attachment Extra  Xtreme is not there, it seems to be not supported in UFT/QTP.

 

http://support.openview.hp.com/selfsolve/document/KM177487

 

 

 

 

Please check this workaround about how to work with unsupported or thrid party control, hopefully this will help you:

 

http://support.openview.hp.com/selfsolve/document/KM186906

 

QuickTest Professional will often recognize these objects as generic objects (WinObject, SwfObject, WebElement, etc.) and will record generic methods (.Click) against them. It is possible to create replay functions to improve the support for these controls. These replay functions can use a combination of the following:

Note: The functions and examples in this article are not part of QuickTest Professional. They are not guaranteed to work and are not supported by HP (Former Mercury) Customer Support. End-users are responsible for any and all modifications that may be required.

 

  1. Object property. Use the mentioned property to access the controls own properties and methods. For more information on .Object, refer to Document ID KM177318 - How to access an object's methods and properties.

    Following example uses .Object to implement two methods (Expand and Select) for a sample Tree control. The sample script, UnsupportedTreeView, is in the attached .zip file. Attachment:  CPT33302.zip

    ' oTree: The TreeView object
    ' TreePath : The path in the TreeView to expand
    Function SwfTVExpand ( oTree, TreePath )
        ' / is the path delimiter
        nodes = split ( TreePath, "/" )
        If UBound(nodes) > 1 Then
           ' Get the node object for each item in the path and expand it
           tvPath = nodes(0)
           Set oNode = oTree.Object.GetNodeFromPath ( tvPath ) 
           oNode.Expand 

           For i=1 to UBound(nodes)
              tvPath = tvPath + "/" + nodes(i)
              Set oNode = oTree.Object.GetNodeFromPath ( tvPath ) 
           oNode.Expand 
           Next
        Else 
           ' Get the node object
           Set oNode = oTree.Object.GetNodeFromPath ( TreePath ) 
        End If

        oTree.Object.EnsureVisible oNode
    End Function

    ' oTree: The TreeView object.
    ' TreePath : The path to the node to select.
    ' Btn: The mouse button to click ( 0=LEFT, 1=MIDDLE, 2=RIGHT )
    ' Offset: The X offset of the node to select.
    Function SwfTVSelect ( oTree, TreePath, Btn, Offset )
        ' Make sure the item is visible and the TreePath is expanded
        SwfTVExpand oTree, TreePath

        ' Get the bounds of the node we want to click on
        Set oBounds = oTree.Object.GetNodeFromPath ( TreePath ).Bounds

        ' Calculate the location of the node we want to click on
        nodes = split ( TreePath, "/" )
        absx = oTree.GetROProperty("abs_x")
        absy = oTree.GetROProperty("abs_y")

        ' 20 indicate the indentation of each node in pixels
        Set oDev = CreateObject("mercury.devicereplay")
        oDev.MouseClick absx + Offset + (UBound(nodes)+1) * 20, absy + oBounds.y + ( oBounds.Height / 2 ), Btn
    End Function

    ' Register the functions for use with the SwfObject
    RegisterUserFunc "SwfObject", "Select", "SwfTVSelect"
    RegisterUserFunc "SwfObject", "Expand", "SwfTVExpand"


    SwfWindow("TreeViewAdv Owner Draw").Activate
    SwfWindow("TreeViewAdv Owner Draw").SwfObject("treeViewAdv1").Expand "c:/Program Files/Mercury Interactive/QuickTest Professional"
    SwfWindow("TreeViewAdv Owner Draw").SwfObject("treeViewAdv1").Select "c:/Program Files/Mercury Interactive/QuickTest Professional/samples/flight", 0, 0



    The RegisterUserFunc method registers the function for use with a QuickTest test object. For more information, please refer to 
    Document ID KM180758 - How to register a user-defined function for use with objects.


  2. Low-Level or Analog Recording. When control isn't being recognized by the environment (.NET, Java, Web, etc), enable the "Low-Level" or "Analog" mode (under Automation menu), to instruct QTP about recognizing all keyboard and/or mouse interactions done against the application understing. This will only recognized objects as windows standard objects.

  3. Insight Objects. Document ID KM00271874 - Best Practices for using the UFT Insight feature

  4. Device Replay. Use this feature (arrow keys and mouse clicks) to perform actions. For more information on using Device Replay, refer to Document ID KM184330 - How to use the Device Replay feature.


    Following example uses Device Replay, arrow keys, and/or mouse clicks to implement three methods (GridSelectCell, GridSetCellData, and GridGetCellData) for a sample Grid control. The sample script, UnsupportedGrids, and a sample application, NETWinControls, are provided in the attached .zip file. (Please note that this grid is supported by QuickTest Professional and the .Net add-in, but is treated as an unsupported grid in this example.) 

    The "wscript.shell" object is a good alternative emulating key strokes. Check MSDN for additional information. Also, "mercury.devicereplay" is a good way to move the mouse around if needed.

    ' Launch the "NETWinControls.exe" and run this example

    ' oGrid: The grid object.
    ' Row: The row containing the cell to select.
    ' Col: The column containing the cell to select.
    Function GridSelectCell ( oGrid, Row, Col )
        ' Set Focus to the grid by clicking somewhere in the grid
        oGrid.Click 64,64

        ' This key combination will set focus to the first row and column
        oGrid.Type micLCtrlDwn + micLeft + micLCtrlUp
        oGrid.Type micLCtrlDwn + micUp + micLCtrlUp

        ' Scroll down to the correct row by using arrow key down
        For r=1 to Row-1
           oGrid.Type micDwn
        Next

        ' Scroll down to the correct column by using right arrow key
        For c=1 to Col-1
           oGrid.Type micRight
        Next
        ' You might want to enable the cell in some cares by press the "EnterKey"
    End Function

    ' oGrid: The grid object.
    ' Row: The row containing the cell.
    ' Col: The column containing the cell.
    ' Data: The data to enter into the cell.
    Function GridSetCellData( oGrid, Row, Col, Data )
        GridSelectCell oGrid, Row, Col

        ' Things to look out for
        ' 1. Does the edit field have focus by default when its selected?
        ' 2. Is the current text in the cell being deleted when you type in the edit field?
        ' 3. Try and mimic user actions
        ' 4. keep an eye on the behavior(s) of the cell in question. Do whatever is needed for it to work.

        ' In this case the function shows you how to treat the cell as an Edit Field.
        ' oGrid.Type Data ' would have worked in this instance.

        ' This will get you the Parent Test Object which is the "Window("Grid Control") in this case

        Set oParent = oGrid.GetTOProperty("parent")
        oParent.WinEdit("focused:=true").Highlight
        oParent.WinEdit("focused:=true").Set ""
        oParent.WinEdit("focused:=true").Type Data + micTab
    End Function

    ' oGrid: The grid object.
    ' Row: The row containing the cell.
    ' Col: The column containing the cell.
    Function GridGetCellData( oGrid, Row, Col )
        GridSelectCell oGrid, Row, Col

        ' Things to look out for
        ' 1. Make sure that the cell has focus or is editable
        ' 2. What kind of operations is needed for you to enable the cell.
        ' 3. Try and mimic user actions
        ' 4. keep an eye on the behavior(s) of the cell in question. Do whatever is needed for it to work.

        ' This will get me the Parent Test Object which is the "Window("Grid Control") in this case

        Set oParent = oGrid.GetTOProperty("parent")
        oParent.WinEdit("focused:=true").Highlight
        GridGetCellData = oParent.WinEdit("focused:=true").GetROProperty("text")
    End Function

    ' Register the functions for use with the WinObject
    RegisterUserFunc "WinObject", "GridSelectCell", "GridSelectCell"
    RegisterUserFunc "WinObject", "GridSetCellData", "GridSetCellData"
    RegisterUserFunc "WinObject", "GridGetCellData", "GridGetCellData"

    If Not Window(".NET Windows Controls").Window("Grid Control").Exist (2) Then
        ' Grid is not visible, open it and populate it with some values
        Window(".NET Windows Controls").WinMenu("Menu").Select "Other Controls;Grid" 
        Window(".NET Windows Controls").Window("Grid Control").WinObject("ReadOnly").Click 6,11
        Window(".NET Windows Controls").Window("Grid Control").WinObject("Add Rows").Click 38,10
        Window(".NET Windows Controls").Window("Grid Control").WinObject("Add Rows").Click 38,10
        Window(".NET Windows Controls").Window("Grid Control").WinObject("Add Rows").Click 38,10
    End If

    Window(".NET Windows Controls").Window("Grid Control").WinObject("Table").GridSetCellData 2,3, "Hello"

    MsgBox Window(".NET Windows Controls").Window("Grid Control").WinObject("Table").GridGetCellData ( 6,7 )
    MsgBox Window(".NET Windows Controls").Window("Grid Control").WinObject("Table").GridGetCellData ( 2,3 )


    The RegisterUserFunc method registers the function for use with a QuickTest test object. For more information, please refer to 
    Document ID KM180758 - How to register a user-defined function for use with objects.



  5. Map Test Objects. If the objects in question have a particular type of nativeclass, it may be possible to map such generic object to a standarized control, for example mapping the class "RichEdit20A" to a "WinEdit" test object. For more information see Document ID KM179011 - How to get QuickTest Professional to recognize and work with custom objects



  6. Virtual Objects. This type of controls are based on relative coordinates (not absolute coordinates based on screen, instead based on upper left corner of parent object) plus height and width. For more information, review section called "Learning Virtual Objects" of the QuickTest Professional User Guide version being used



  7. Extensibility toolkits. If working with .Net, Java, Web or WPF objects, use the QuickTest Professional Add-in Extensibility respective to such technology. For more information about such topics, see:


    Note: 
    If you require additional assistance, you can contact the HP Professional Services organization to have a consultant implement support for your controls. 

    1. .NET ApplicationsDocument ID KM191515 - How to support "unsupported" .NET controlsDocument ID KM197050 - How to use .Net Extensibility (example, tips, and tricks)Document ID KM870382 - What is the .NET Add-in Extensibility supported Microsoft Visual Studio versions 

    2. Java applications: "Java Extensibility Developer Guide" offered for each particular version of the extensibility add-in

    3. Web applicationsDocument ID KM777252 - Does QuickTest Professional support Web 2.0 applications (ASP AJAX, GWT, Dojo, Yahoo UI, etc)? andDocument ID KM861102 - FAQ: How to Start Creating Web Extensibility Solutions

    4. WPF ApplicationsDocument ID KM918948 - Is there a WPF extensibility toolkit for QTP?

 

Please mark this answer as accepted solution or correct answer if this answered your question.

 

Best regards,

Ruddy Alvarez H.
Customer Support Engineer

If you find thst aat this or any other post resolves your issue, please be sure to mark it as an accepted solution.
If you are satisfied with anyone’s response please remember to give them a KUDOS by clicking on the STAR at the bottom left of the pond show your appreciation.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.