• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Safari - do JavaScript
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Safari - do JavaScript


  • Subject: Safari - do JavaScript
  • From: "white-island.org" <email@hidden>
  • Date: Tue, 02 Dec 2014 14:16:02 +0100

Hi, its been a while…
Great to see this is still evolving.

I just tried to crawl for some data from Safari with _javascript_:

on getImage()
set theImage to {}
try
tell application "Safari"
set theTab to current tab of window 1
set theScript to "document.getElementsByClassName('flex-active-slide').innerHTML"
set theImage to do _javascript_ theScript in theTab
end tell
on error err
log err
end try
return theImage
end getImage

log getImage()

Replies:

tell application "Safari"
get current tab of window 1
--> tab 1 of window id 64
do _javascript_ "document.getElementsByTagName('flex-active-slide').innerHTML" in tab 1 of window id 64
--> missing value
end tell
(*missing value*)

The function always returns „missing value“, no matter what I tried on the DOM.
The only _javascript_ response I got so far was for the title tag of the page.
Everything else just returns „missing value“.

Safari 8.0
OS 10.10.1

Cheers

Klaus G. Umland


 _______________________________________________
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

  • Prev by Date: Re: Scripting alerts
  • Next by Date: Safari - do JavaScript
  • Previous by thread: Re: Scripting alerts
  • Next by thread: Safari - do JavaScript
  • Index(es):
    • Date
    • Thread