Search code examples
hp-uft

How to press enter using UFT


I have one function setfieldvalue that enters data into a text field. Then I call pressenter function to press enter. Cursor was already in the text field. I am not sure why UFT does not press enter.

Public Function PressEnter()
    Set WshShell = CreateObject("WScript.Shell")
    Wait(1)
    WshShell.SendKeys "{ENTER}"
    Set WshShell = Nothing
End Function

How can I write a function which will press enter where the cursor is?


Solution

  • Try using DeviceReplay.

    Set devRep = CreateObject("Mercury.DeviceReplay")
    devRep.PressKey 28