以下是代码:
static void Main(string[] args)
{
Semaphore loadFinished = new Semaphore(0, 1);
WebCore.Initialize(new WebCoreConfig() { CustomCSS = "::-webkit-scrollbar { visibility: hidden; }" });
using (WebView webView = WebCore.CreateWebView(1200, 800))
{
webView.LoadCompleted += (a, b) =>
{
loadFinished.Release();
};
webView.LoadURL("http://store.apple.com/ca/browse/home/shop_iphone/family/iphone/iphone4s");
loadFinished.WaitOne();
webView.Render().SaveToJPEG(@"D:\Users\menkaur\Documents\stream\2012\apple-store\awesonium\result.jpg", 100);
}
// Announce.
Console.Write("Hit any key to see the result...");
Console.ReadKey(true);
// Start the application associated with .png files
// and display the file.
Process.Start(@"D:\Users\menkaur\Documents\stream\2012\apple-store\awesonium\result.jpg");
// Shut down Awesomium before exiting.
WebCore.Shutdown();
Console.ReadKey(true);
}
网站永不加载;然而,从正常的铬合金看,它看起来很好;另外,我已经使用google.com对代码进行了测试,并且工作正常
可能出现什么问题?
答案 0 :(得分:1)
确定。这是解决方案:
while (!loadFinished.WaitOne(100))
{
WebCore.Update();
}