bugfinder
bugfinder

Reputation: 203

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?

Upvotes: 1

Views: 3967

Answers (1)

Motti
Motti

Reputation: 114695

Try using DeviceReplay.

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

Upvotes: 1

Related Questions