do JavaScript, source of document, properties where have you gone!

Hi, I’ve been lurking for a bit but have run into a problem that I just cannot find the answer to. I have a large family of scripts that rely on Safari’s do JavaScript and the document properties like source of and text of. I am now working on an XCode Applescript app that has several webviews and a tab with a summary of the data contained within the webpages displayed in the web views. I found the following function online which i have adapted in my script for my needs but I cannot figure out how to get into the dom or get the text/source of the page. Any help even a link off to an object reference and how to read it would be greatly appreciated. In highschool computer science class was C and Pascal and I’ve handled up on JavaScript pretty well i think but have not ventured into Objective C or any of the cool object oriented languages. Anyhow thanks alot I really hope someone out there can help.

Is there maybe a different ?method or property i can access of mainFrame ???

Thank you in advance


    * on loadPage from theURL
          o set URLWithString to call method "URLWithString:" of class "NSURL" with parameter theURL
          o set requestWithURL to call method "requestWithURL:" of class "NSURLRequest" with parameter URLWithString
          o tell window "main"
                + set mainFrame to call method "mainFrame" of object (view "browser")
          o end tell
          o call method "loadRequest:" of mainFrame with parameter requestWithURL
    * end loadPage

Well FYI I’ll spend my free time today searching for an xCode / obj c answer if anyone has any tips or directions to point me in it will be well accepted

:smiley:

Ok. i went out and did my homework today and found

http://developer.apple.com/documentation/Cocoa/Reference/WebKit/Classes/WebFrame_Class/Reference/Reference.html

This document mentions :

DOMDocument : - (DOMDocument *)DOMDocument
Returns nil if the receiver doesn’t have a DOM document; for example, if it’s a standalone image.

I found this DOMDocument reference only via the Developer connection. So now I’ve got a much more specific request question / request for help.

Does anyone know or have a reference that explains how to access the DOMDocument of an HTML Document loaded into a web view object via the loadRequest method? My goal is to be able to manipulate various UI elements and CSS properties via the DOM.

Big thanks to anyone who might be able to assist