I'm trying to write a unit test that needs access to a WebView. Here's
the code I use to create and load a URL:
NSRect webViewRect = NSMakeRect(0, 0, 10, 10);
WebView *webView = [[WebView alloc] initWithFrame:webViewRect
frameName:@"frameName" groupName:@"groupName"];
NSString *urlText = [NSString
stringWithString:@"http://www.apple.com"];
NSLog(@"loading URL %@", urlText);
[[webView mainFrame] loadRequest:[NSURLRequest
requestWithURL:[NSURL URLWithString:urlText]]];
float progress = [webView estimatedProgress];
NSLog(@"%f download", progress);
The code compiles and executes, but the progress of the loading never
gets past 0.1. Even if I put in a loop, the progress still says 0.1.
Any thoughts as why the progress is stalled, or how I can use WebView
in a non-GUI?