Re: Do JavaScript (Press Button)
Re: Do JavaScript (Press Button)
- Subject: Re: Do JavaScript (Press Button)
- From: julifos <email@hidden>
- Date: Thu, 12 Jun 2003 00:03:50 +0200
>
Is there a way of clicking a button on a webpage using the do javascript
>
command in safari? This would be a regular <form> button with no special
>
javascript written in the page. If this isn't possible, would there be a
>
way if there was a script written in the page? Thanks.
>
>
Stephen Swift
>
email@hidden
The JavaScript method is "click()", but I think this is still broken in
Safari (at least, it doesn't work here).
This sample does not work in <
http://www.google.com/>
###############################
tell application "Safari"
do JavaScript "document.f.btnG.click()" in document 1
end tell
###############################
You can "submit()" the form (if we are talking about a submit button)
###############################
tell application "Safari"
do JavaScript "document.f.submit()" in document 1
end tell
###############################
Or you can call a javascript function in the page which DOES NOT click the
button, but can execute the attached-to-the-button-script, which is very
ugly.
Or you can still use IE or Omniweb (didn't tested this yet).
Returning to the original question, I think you can't click a regular button
in Safari except for by-hand (or at least, this function is broken in my
Safari's copy). Anyway, if you wish try it, test the code above with
"
http://www.google.com/" in your front page.
JJ
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.