Learning Applescript: Trouble Linking To Safari
Run Down Hello, this is a very specific and situation question. Basically, I'm running Applescript in Automator on Safari, and the result is Null. What I Have I currently have a sc
Solution 1:
Unfortunately I don't have a lot of time to answer all your questions as it's late and I need to get to bed, but here is an example of all you need to do. No need for automator, that just seems to complicate your process to me.
You may want to tweak some of the sleep
settings a little if you need more "wait" time, I tried this on my local web server and it worked, but it's local so the site loads very fast.
on run
set i to 1repeatuntil i > 5do shell script "sleep 2"
tell application "Safari"
activate
tell window 1
set properties of current tab to {URL:"http://yoururl.com"}
end tell
end tell
do shell script "sleep 3"
tell application "Safari"
tell document 1do JavaScript "document.getElementById(\"75610556\").click();"end tell
quit
end tell
set i to i + 1endrepeatend run
Also note, you'll need to change the url to your url where it says "http://yoururl.com" and you'll probably want to change the 5 in repeat until i > 5
to a larger number to let it repeat more.
Post a Comment for "Learning Applescript: Trouble Linking To Safari"