Script to navigate Safari

I am a new AppleScripter and need some help, can anybody help?
I regularly open a number of webmail pages which require a username and password.

I need a script to open a specific webmail page. That part I can do.
This next part I can’t do.
Then.
Perform keystroke “tab” to move to the first input field.
Enter a username.
Perform keystroke “tab” to move to the second input field.
Enter a password.
Perform keystroke “return” to submit the info.

Any suggestions or answers Please.

Something like this should work:

tell application "Safari"
	activate
	open location "http://www.locationOfInterest.com"
	tell application "System Events"
		keystroke tab using option down
		delay 0.5
		keystroke "username"
		delay 0.5
		keystroke tab using option down
		delay 0.5
		keystroke "password"
		delay 0.5
		keystroke return
	end tell
end tell

(fiddling with delay values as necessary). Hope that helps…

  • Dan

With a bit of adjustments that worked really well.
Thank you for the help.