コード例 #1
0
        public WebDriverDownloader(Browser browser = Browser.Phantomjs, int webDriverWaitTime = 200, Option option = null)
        {
            Option = option ?? new Option();
            _webDriverWaitTime = webDriverWaitTime;
            _browser = browser;

            if (browser == Browser.Firefox)
            {
                Task.Factory.StartNew(() =>
                {
                    while (true)
                    {
                        IntPtr maindHwnd = WindowsFormUtil.FindWindow(null, "plugin-container.exe - 应用程序错误");
                        if (maindHwnd != IntPtr.Zero)
                        {
                            WindowsFormUtil.SendMessage(maindHwnd, WindowsFormUtil.WmClose, 0, 0);
                        }
                        Thread.Sleep(500);
                    }
                    // ReSharper disable once FunctionNeverReturns
                });
            }
        }
コード例 #2
0
 public WebDriverPool(Browser browser, int capacity = 5, Option option = null)
 {
     _capacity = capacity;
     _browser = browser;
     _option = option ?? new Option();
 }