0

I need to automatically push a "submit" button on a webview. I have:

#import <Cocoa/Cocoa.h>
#import <WebKit/WebKit.h>
#import <WebKit/WebResourceLoadDelegate.h>
@interface AppDelegate : NSObject <NSApplicationDelegate>

@property (assign) IBOutlet NSWindow *window;
- (IBAction)start:(id)sender;
@property (weak) IBOutlet NSTextField *UserNameField;
@property (weak) IBOutlet NSTextField *PasswordField;
@property (weak) IBOutlet NSPopUpButton *IntervalSelector;
@property (weak) IBOutlet WebView *browser;
@property (weak) IBOutlet NSTextField *IDField;

@end

The browser has finished loading, so how do I program an automatic "submit" button push? I don't know why it won't work, any pointers?

1
  • You would need to redirect to the target url. You can't "automatigically push" a submit button, but you can redirect. Commented Jul 13, 2012 at 19:32

1 Answer 1

1

You could always manipulate the DOM elements to do this kind of things (even submitting a form). Something like:

NSString *js = @"document.forms['loginform'].elements['Email'].value='[email protected]'";
[[myWebView windowScriptObject] evaluateWebScript:js];
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.