Tuesday, 6 November 2012

QTP without using QTPScript



Write VBScript code without using QTPScript for below scenario
Ø  Launch google website
Ø  Enter a word in search box
Ø  Select third word in cache
Ø  Search the selected word
Ø  Close site

Option explicit
Dim bro, url, wsho, i
‘Launch google website
Bro= “C:\\Program Files\Internet Explorer\iexplore.exe
invokeapplication (bro&” “&url)
‘Keyboard automation using VBscript
Set wsho=createobject (“wscript.shell”)
Wait (10)
Wsho.sendkeys (“QTP”)
Wait (5)
For i= 1 to 3 step 1
Wsho.sendkeys(“{DOWN}”)
Wait (5)
Wsho.sendkeys(“{ENTER}”)
Wait (5)
‘closing google website
Wsho.sendkeys (“%{F4}”)

No comments:

Post a Comment