Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to automate webpage in IE 1

Status
Not open for further replies.

jackeroo75

Technical User
Aug 26, 2007
34
US
I know how to get to the website, but how do I choose from the 3 radio buttons. Then choose from a listbox and click go. Then refresh the page.

Here is the website.
I want to 1. Click on View Jail Register. 2. Choose the second radio button which says "Those booked within the last 24 hours"
and click submit. 3. Choose from the listbox = "BA" and click
GO. And want to continously refresh it every 30 seconds.

How do I automate this???
 
[tt]surl="set oie=createobject("internetexplorer.application")
with oie
.navigate surl
do while .readystate<>4 : wscript.sleep 50 : loop
.document.getElementById("lnk_viewjr").click()
do while .readystate<>4 : wscript.sleep 50 : loop
.getElementById("radBookedLast24_radio").checked=true
.getElementById("btnSubmit").click()
do while .readystate<>4 : wscript.sleep 50 : loop
.visible=true
end with
[/tt]
 
Correction
Inadvertently deleted some document reference upon posting! Here is a relist.
[tt]
surl="set oie=createobject("internetexplorer.application")
with oie
.navigate surl
do while .readystate<>4 : wscript.sleep 50 : loop
.document.getElementById("lnk_viewjr").click()
do while .readystate<>4 : wscript.sleep 50 : loop
[blue].document[/blue].getElementById("radBookedLast24_radio").checked=true
[blue].document[/blue].getElementById("btnSubmit").click()
do while .readystate<>4 : wscript.sleep 50 : loop
.visible=true
end with
[/tt]
 
Hi tsuji-

Thank you for your posting, but I'm getting an error msg during run-time.

this is the error msg I rec'd :

Object required:'document.geElementByID(...)'

I'm using IE 6.0 and windows xp.
 
Add some control to it as shown below so that the loading delay is out of the way.
[tt]
surl="set oie=createobject("internetexplorer.application")
with oie
.navigate surl
do while .readystate<>4 : wscript.sleep 50 : loop
.document.getElementById("lnk_viewjr").click()
do while .readystate<>4 : wscript.sleep 50 : loop
[blue]do while .document.getElementById("radBookedLast24_radio") is nothing
wscript.sleep 50
loop[/blue]
.document.getElementById("radBookedLast24_radio").checked=true
.document.getElementById("btnSubmit").click()
do while .readystate<>4 : wscript.sleep 50 : loop
.visible=true
end with
[/tt]
After the functionality is done, you have to add some more control to make it more robust and to avoid waiting forever due to design change of the page or else.
 
Thanks Tsuji!

I got it to work on mozilla and not IE, but I still need to choose from the listbox "BA" and then click go. Any help with this would be greatly appreciated.

Also, what's a good website u rec. that can give me advice. I really want to learn the code but unable to find any good doc.

 
>I got it to work on mozilla and not IE.
Don't know what you're talking about! You've got it to work on mozilla? Maybe you've you own script not mine.
 
Hey tsuji-

So how do I automate the listbox to chose "BA" ???
 
[tt]surl="set oie=createobject("internetexplorer.application")
with oie
.navigate surl
do while .readystate<>4 : wscript.sleep 50 : loop
do while strcomp(.document.readystate,"complete",1)<>0 : wscript.sleep 50 : loop
.document.getElementById("lnk_viewjr").click()
do while .readystate<>4 : wscript.sleep 50 : loop
do while strcomp(.document.readystate,"complete",1)<>0 : wscript.sleep 50 : loop
.document.getElementById("radBookedLast24_radio").checked=true
.document.getElementById("btnSubmit").click()
do while .readystate<>4 : wscript.sleep 50 : loop
do while strcomp(.document.readystate,"complete",1)<>0 : wscript.sleep 50 : loop
.document.getElementById("drpSortBy").value="BA"
.document.getElementById("btnSort").click()
.visible=true
end with
[/tt]
ps: The modification on the waiting relies hereby less on the page structure and hence avoided indefinite waiting.
 
Tsuji,

I just want to thank you for helping a newbie out.

Jackeroo75
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top