QTP Script:How to turn On and turn Off Capslock using SendKeys in QTP?




QTP SCript to turn on Capslock using SendKeys in QTP


Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.SendKeys "{CAPSLOCK}"
Msgbox"CapsLock is ON"
WshShell.SendKeys "{CAPSLOCK}"
Msgbox"CapsLock is OFF"


Similarly we can turn On/Off NumLock and ScrollLock also.

WshShell.SendKeys "{NUMLOCK}"

WshShell.SendKeys "{SCROLLLOCK}"

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}")

QTP Scripts:How to get total count of number of folders in Inbox Folder of Outlook Application


Qtp script to get total count of number of folders in Inbox Folder of Outlook Application



Set a = CreateObject("Outlook.Application")

Set b = a.GetNameSpace("MAPI")

Set c = b.GetDefaultFolder(6)

Msgbox " Folders Count = " & c.folders.count 

Related Posts Plugin for WordPress, Blogger...

Fun and Knowledge