Tuesday, 6 July 2021

Write a Program to open new browser with given URL and enter data and take screen shot & save

set a_shll=createobject("shell.application")
a_shll.MinimizeAll

WScript.Sleep 3000
Dim Mon,Tue,Wed,Thu,Fri,Usr,Pwd,Path

Mon="8"
Tue="0"
Wed="0"
Thu="0"
Fri="8"

'Usr="SMeti693G"
'Pwd="meti@123"
Path="d:\Suresh Meti " &DatePart("d", Now) & "-" & DatePart("m", Now) & "-" & DatePart("yyyy", Now) &".png"

set a = createobject("wscript.shell")
a.run "www.google.co.in"
wscript.sleep (5000)
a.SendKeys "{TAB}"
a.SendKeys "{TAB}"
a.SendKeys "{ENTER}"


wscript.sleep (5000)
a.SendKeys "{TAB}"
wscript.sleep (1000)
a.SendKeys "{TAB 2}"
wscript.sleep (1000)
a.SendKeys "{TAB 26}"
wscript.sleep (1000)
a.SendKeys Mon
a.SendKeys "{TAB}"
wscript.sleep (1000)
a.SendKeys Tue
a.SendKeys "{TAB}"
wscript.sleep (1000)
a.SendKeys Wed
a.SendKeys "{TAB}"
wscript.sleep (1000)
a.SendKeys Thu
a.SendKeys "{TAB}"
wscript.sleep (1000)
a.SendKeys Fri
wscript.sleep (1000)

a.SendKeys "{TAB}"
wscript.sleep (2000)
a.SendKeys "{TAB 2}"
wscript.sleep (2000)
a.SendKeys "{TAB 21}"

'Need to write for Submit

'-----------------
'To Capture screen shot

Set OBJ_WB = CreateObject("Word.Basic")
OBJ_WB.SendKeys "{prtsc}"
'OBJ_WB.AppClose "Microsoft Word"
Set OBJ_WB = Nothing
Set a_shll = Nothing

'Open MSPaint in maximize mode
a.Run "mspaint",3
WScript.Sleep 2000

'Activate MSPaint
a.AppActivate "untitled - Paint"
WScript.Sleep 2000

'Paste the Screenshot
a.SendKeys "^v"
WScript.Sleep 2000

'Save MSPaint file
a.SendKeys "^s"
WScript.Sleep 2000

a.SendKeys Path

WScript.Sleep 2000
a.SendKeys "{ENTER}"
WScript.Sleep 1000
a.Run "taskkill /im mspaint.exe", , True
WScript.Quit

No comments:

Post a Comment