• 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
Re: Web Renderer (URL -> image)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Web Renderer (URL -> image)


  • Subject: Re: Web Renderer (URL -> image)
  • From: Takaaki Naganoya <email@hidden>
  • Date: Wed, 16 Sep 2015 16:00:50 +0900

2015/09/16 13:44、Shane Stanley <email@hidden> のメール:
On 16 Sep 2015, at 1:28 PM, Takaaki Naganoya <email@hidden> wrote:
But this script’s rendered image is not same as Safari.
The Page header and footer are quite different (not drawn).

Your version string suggests you are running 10.10, where Apple introduced the WKWebView class as a replacement for the WebView class. Could that explain the difference?

Oh…WkWebView does not support Notification!?
Key Value Observing ?!
Can we use KVO in AppleScript?  ...I’m afraid not.

Hmm…loop and check loading status may be available….

I think WkWebView’s loading is completed….

<AppleScript>
-- Created 2015-09-16 by Takaaki Naganoya
-- 2015 Piyomaru Software
use AppleScript version "2.4"
use scripting additions
use framework "Foundation"
use framework "WebKit"

property theWebView : missing value


set aURL to "http://www.apple.com/us/shop/browse/home/specialdeals/mac"
set aRes to getPage(aURL)
theWebView
--> (WKWebView) <WKWebView: 0x6000003b9980>

on getPage(aURL)
set thisURL to current application's |NSURL|'s URLWithString:aURL
set theRequest to current application's NSURLRequest's requestWithURL:thisURL


set (my theWebView) to current application's WKWebView's new()
(my theWebView)'s loadRequest:theRequest


set waitLoop to 1000 * 60 --60 seconds


set hitF to false
repeat waitLoop times
set aLoadF to ((my theWebView)'s estimatedProgress()) as number
if aLoadF = 1.0 then
set hitF to true
exit repeat
end if
current application's NSThread's sleepForTimeInterval:("0.001" as real) --delay 0.001
end repeat


return hitF
end getPage

</AppleScript>


--
Takaaki Naganoya
email@hidden
http://piyocast.com/as/




 _______________________________________________
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

References: 
 >Web Renderer (URL -> image) (From: Takaaki Naganoya <email@hidden>)
 >Re: Web Renderer (URL -> image) (From: Shane Stanley <email@hidden>)
 >Re: Web Renderer (URL -> image) (From: Takaaki Naganoya <email@hidden>)

  • Prev by Date: Re: Web Renderer (URL -> image)
  • Next by Date: Re: Web Renderer (URL -> image)
  • Previous by thread: Re: Web Renderer (URL -> image)
  • Next by thread: Re: Web Renderer (URL -> image)
  • Index(es):
    • Date
    • Thread