Waiting for a web page to be fully loaded
Waiting for a web page to be fully loaded
- Subject: Waiting for a web page to be fully loaded
- From: Victor <email@hidden>
- Date: Wed, 21 Apr 2010 17:04:54 +0200
Within a web page in Safari a service I built with automator simply running an AS needs to input some keystroke only when each page is fully loaded. In the example below after clicking "F24" AS should wait for the complete loading of the new page.
For that reason I'm trying to use the code below which resort (taken from somewhere in the internet) to the "do javascript" command. To no avail. I mean that the code runs but invariably passes the test of the repeat line without looping thru the "delay 1" line even though the web page is still being loaded.
What's wrong with it?
Ciao from Rome
Vittorio
on run {}
tell application "System Events"
tell process "Safari"
tell UI element 2 of row 1 of table 1 of UI element 1 ¬
of scroll area 2 of UI element 1 of scroll area 2 of UI element 1 of scroll area 1 of group 3 of window 1
click UI element "Pagamenti"
delay 0.5
click UI element "Imposte e tributi"
delay 0.5
click UI element "F24"
--
--
tell application "Safari"
repeat until (do JavaScript "document.readyState" in document 1) is "complete"
delay 1
set N to N + 1
if N is 60 then -- there was a problem loading the page
error number -128
end if
end repeat
end tell
--
end tell
perform action "AXPress" of image 1 of UI element 1 of group 6 ¬
of UI element 1 of scroll area 3 of UI element 1 of scroll area 2 ¬
of UI element 1 of scroll area 1 of group 3 of window 1
.........
end run _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden