public WebDriverDownloader(Browser browser, int webDriverWaitTime = 200, Option option = null) { _webDriverWaitTime = webDriverWaitTime; _browser = browser; _option = option ?? new Option(); if (browser == Browser.Firefox && RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { Task.Factory.StartNew(() => { while (!_isDisposed) { IntPtr maindHwnd = WindowsFormUtils.FindWindow(null, "plugin-container.exe - 应用程序错误"); if (maindHwnd != IntPtr.Zero) { WindowsFormUtils.SendMessage(maindHwnd, WindowsFormUtils.WmClose, 0, 0); } Thread.Sleep(500); } }); } }
public FiddlerDownloader(string urlParten, Option option, int webDriverWaitTime = 200) { _option = option; _option.Proxy = "127.0.0.1:30000"; _webDriverWaitTime = webDriverWaitTime; Task.Factory.StartNew(() => { while (true) { IntPtr maindHwnd = WindowsFormUtils.FindWindow(null, "plugin-container.exe - 应用程序错误"); if (maindHwnd != IntPtr.Zero) { WindowsFormUtils.SendMessage(maindHwnd, WindowsFormUtils.WmClose, 0, 0); } Thread.Sleep(500); } // ReSharper disable once FunctionNeverReturns }); _fiddlerClient = new FiddlerClient(30000, urlParten); _fiddlerClient.StartCapture(); }