Login onto website catches on url

I"m using the following partial script to log onto a website.
Sometimes it works and sometimes the data that is supposed to go into a fill in box types into the url location of the browser.
How can I make this script more stable?

tell application "Safari"
	activate
open location site_url
	-- wait until page loaded
end tell
tell application "System Events"
	keystroke tab & conname
endtell

Maybe you can tweak this script.

tell application "Safari" to activate
open location "http://discussions.info.apple.com/webx?login@727.hLCraGIUXQ6.3@.ee6b280!login=yes"
tell application "System Events"
tell application process "Safari"
delay 6
keystroke (ASCII character 9) -- this equals tab
keystroke (ASCII character 9)
delay 1
keystroke "YourName"
delay 1
keystroke (ASCII character 9)
delay 1
keystroke "YourPassword"
keystroke (ASCII character 13) -- this equals return
end tell
end tell

Tom

If you are comfortable sticking with Safari and using JavaScript a bit, you can use Safari’s do JavaScript command.

Here are a couple of recent threads that might be of use: http://bbs.applescript.net/viewtopic.php?pid=92608#p92608 and http://bbs.applescript.net/viewtopic.php?pid=94104#p94104.