Re: Call getElementById in Cocoa

2008-11-25 Thread Rob Keniger
On 25/11/2008, at 12:32 PM, Pierce Freeman wrote: Sorry for my newbie-ness, but I still don't really get what you are talking about. Are you saying that I should do this: [WebView setFrameLoadDelegate:didFinishLoadForFrame]; - (void)didFinishLoadForFrame { // Do stuff } No, you would d

Re: Call getElementById in Cocoa

2008-11-24 Thread Pierce Freeman
Okay Adam, I think I am beginning to understand. However, I just get two problems trying to run that code: 1. error: 'request' undeclared (first use in this function) 2. warning: 'webView' may not respond to '+isLoading' Thanks for your help. Sincerely, Pierce Freeman -- Pierce Freeman [EMA

Re: Call getElementById in Cocoa

2008-11-24 Thread Adam R. Maxwell
On Nov 24, 2008, at 6:32 PM, Pierce Freeman wrote: Sorry for my newbie-ness, but I still don't really get what you are talking about. Are you saying that I should do this: [WebView setFrameLoadDelegate:didFinishLoadForFrame]; - (void)didFinishLoadForFrame { // Do stuff } No. Here you

Re: Call getElementById in Cocoa

2008-11-24 Thread Pierce Freeman
Sorry for my newbie-ness, but I still don't really get what you are talking about. Are you saying that I should do this: [WebView setFrameLoadDelegate:didFinishLoadForFrame]; - (void)didFinishLoadForFrame { // Do stuff } Sincerely, Pierce F. On 11/24/08 6:02 PM, "Adam R. Maxwell" <[EMAI

Re: Call getElementById in Cocoa

2008-11-24 Thread Adam R. Maxwell
On Nov 24, 2008, at 5:53 PM, Pierce Freeman wrote: Thanks for your response, though I am wondering how I could make the delegate method. I know how to do it for NSWorkspace, however not for WebKit. Call -[WebView setFrameLoadDelegate:] and then implement whatever WebFrameLoadDelegate metho

Re: Call getElementById in Cocoa

2008-11-24 Thread Pierce Freeman
Hi Adam: Thanks for your response, though I am wondering how I could make the delegate method. I know how to do it for NSWorkspace, however not for WebKit. Sincerely, Pierce F. On 11/24/08 5:41 PM, "Adam R. Maxwell" <[EMAIL PROTECTED]> wrote: > > On Nov 24, 2008, at 5:10 PM, Pierce Freeman

Re: Call getElementById in Cocoa

2008-11-24 Thread Adam R. Maxwell
On Nov 24, 2008, at 5:10 PM, Pierce Freeman wrote: Okay, sounds good. Just making sure, would that code would work? It looked fine to me; I use something similar for loading URLs in an offscreen webview. As Jean-Daniel pointed out, you'll have to use the delegate methods to tell when it

Re: Call getElementById in Cocoa

2008-11-24 Thread Pierce Freeman
Okay, sounds good. Just making sure, would that code would work? Sincerely, Pierce F On 11/24/08 3:54 PM, "Jean-Daniel Dupas" <[EMAIL PROTECTED]> wrote: > The link I provided is for another option, using Javascript call to > retreive the value, but I think using the native DOM API is prefere

Re: Call getElementById in Cocoa

2008-11-24 Thread Jean-Daniel Dupas
The link I provided is for another option, using Javascript call to retreive the value, but I think using the native DOM API is prefered. Note that before calling mainFrameDocument, you should make sure the document is loaded. There is probably a WebView delegate method that provide this in

Re: Call getElementById in Cocoa

2008-11-24 Thread Pierce Freeman
Does this code convey what you are saying/how to do this? IBOutlet id webView; NSString *urlOfObject = [NSString stringWithFormat: @"http://www.somesite.com/hiddenFieldPage.php";]; [[webView mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:urlOfObject]]]; DomDocument *d

Re: Call getElementById in Cocoa

2008-11-24 Thread Frédéric Testuz
Le 24 nov. 08 à 18:34, Mike Abdullah a écrit : On 24 Nov 2008, at 17:28, Jean-Daniel Dupas wrote: Le 24 nov. 08 à 18:03, Mike Abdullah a écrit : On 24 Nov 2008, at 16:45, John Terranova wrote: On Nov 24, 2008, at 8:11 AM, Jean-Daniel Dupas wrote: You call -mainFrameDocument on your We

Re: Call getElementById in Cocoa

2008-11-24 Thread Mike Abdullah
On 24 Nov 2008, at 17:28, Jean-Daniel Dupas wrote: Le 24 nov. 08 à 18:03, Mike Abdullah a écrit : On 24 Nov 2008, at 16:45, John Terranova wrote: On Nov 24, 2008, at 8:11 AM, Jean-Daniel Dupas wrote: You call -mainFrameDocument on your WebView to get a DOMDocument instance, and have a

Re: Call getElementById in Cocoa

2008-11-24 Thread Jean-Daniel Dupas
Le 24 nov. 08 à 18:03, Mike Abdullah a écrit : On 24 Nov 2008, at 16:45, John Terranova wrote: On Nov 24, 2008, at 8:11 AM, Jean-Daniel Dupas wrote: You call -mainFrameDocument on your WebView to get a DOMDocument instance, and have access to the DOM functions from here (there is no up

Re: Call getElementById in Cocoa

2008-11-24 Thread Matt Long
You can use an NSXMLDocument: NSString *webpageString = [[[NSString alloc] initWithContentsOfURL:@"http://www.google.com "] autorelease]; NSError *error = nil; NSXMLDocument *document = [[NSXMLDocument alloc] initWithXMLString:webpageString

Re: Call getElementById in Cocoa

2008-11-24 Thread Mike Abdullah
On 24 Nov 2008, at 16:45, John Terranova wrote: On Nov 24, 2008, at 8:11 AM, Jean-Daniel Dupas wrote: You call -mainFrameDocument on your WebView to get a DOMDocument instance, and have access to the DOM functions from here (there is no up-to-date doc of the Cocoa DOM API, you will have t

Re: Call getElementById in Cocoa

2008-11-24 Thread John Terranova
On Nov 24, 2008, at 8:11 AM, Jean-Daniel Dupas wrote: You call -mainFrameDocument on your WebView to get a DOMDocument instance, and have access to the DOM functions from here (there is no up-to-date doc of the Cocoa DOM API, you will have to check headers files directly to see what functi

Re: Call getElementById in Cocoa

2008-11-24 Thread Jean-Daniel Dupas
Le 24 nov. 08 à 16:42, Pierce Freeman a écrit : Hi everyone. I am wondering if there is some way to call the getElementById on a website through Cocoa, and then return the value of the field. I am assuming it would somehow be through WebKit, but I am not sure how to do this (as well as

Call getElementById in Cocoa

2008-11-24 Thread Pierce Freeman
Hi everyone. I am wondering if there is some way to call the getElementById on a website through Cocoa, and then return the value of the field. I am assuming it would somehow be through WebKit, but I am not sure how to do this (as well as if the method needs a different way to get the page's code