/// <summary> /// 加载主页面 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Form1_Load(object sender, EventArgs e) { //载入爬虫的xml文件 this.Log("正在读取配置文件"); string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "SpiderConfig"); this.context = ActionLoad.CreateContext(path); if (this.context.Actions.Count > 0) { this.browser = new ChromiumWebBrowser(this.context.Actions[0].search_page_url); this.browser.FrameLoadEnd += FrameLoadEnd; this.scriptBrige = new ScriptBrige(); this.browser.RegisterJsObject("ScriptBrige", this.scriptBrige);//使网页能够调用后端的javascirpt this.pnlMain.Controls.Add(this.browser); this.browser.Dock = DockStyle.Fill; } }