Fill in form with Safari (was: help me im a noob)

ok i need to make a script where i can open safari to “http://ps.sgis.org” then enter the username and password, then click the “enter website” button

can this be done and if it can be can someone help me this is what i got so far:

tell application "Safari"
	activate
	open location "http://ps.sgis.org"
end tell

hi

i always think this is a messy way using system events but it works!

tell application "Safari"
	activate
	open location "http://ps.sgis.org"
end tell
delay 2
tell application "System Events"
	keystroke "username"
	delay 1
	keystroke tab
	keystroke "password"
	delay 0.5
	keystroke return
end tell

thanks a bunch ill try that one out

Tip: Choose a subject that is meaningful to other forum members, not to yourself.

Works for me; thank you Pidge1.

plus the fact that this subject has been answered many times before. You need to perform a search for past posts for an answer before posting questions. I know I was needing this same information over two years ago and found solutions by searching the forums for past posts.

I needed the same a while ago and found these:-

set homePage to "your/url/here"

set jav to "document.form1.login_name.value='your_value';
document.form1.login_pass.value='your_pass';
document.form1.login.click();"

tell application "Safari"
	
	--load your page here
	tell document 1
		set URL to homePage
		
		--do JavaScript code
		do JavaScript jav
		
	end tell
end tell

tell application "Safari"
	activate
	open location "https://www.your_telephone_code.com"
	delay 1
	set areaCode to "512"
	set phone1 to "555"
	set phone2 to "1234"
	repeat until ((do JavaScript "document.readyState" in document 1) is "complete")
		delay 0.5
	end repeat
	
	do JavaScript "document.forms[1].phone1.value = \"" & areaCode & "\"" in document 1
	do JavaScript "document.forms[1].phone2.value = \"" & phone1 & "\"" in document 1
	do JavaScript "document.forms[1].phone3.value = \"" & phone2 & "\"" in document 1
	do JavaScript "document.forms[1].submit()" in document 1
end tell

Not sure if they’re of any use.

Nick