QTP Script(SendKeys Method):How to send keyboard input to QTP?



QTP Script to send keyboard input(SendKeys Method)


Below Qtp Script opens Notepad and enters values in it using SendKeys method



Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "notepad"
WScript.Sleep 500
WshShell.SendKeys "abc"
WshShell.SendKeys "{ENTER}"
WshShell.SendKeys "{CAPSLOCK}"
WshShell.SendKeys "xyz"


A single keystroke can be pressed several times.


Below script types letter "L" 10 times


Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "notepad"
WScript.Sleep 500
WshShell.SendKeys("{L 10}")

No comments:

Related Posts Plugin for WordPress, Blogger...