private void MoocWebBrowser_DocumentCompleted(object sender, Gecko.Events.GeckoDocumentCompletedEventArgs e) { var cookies = CookieManager.GetCookiesFromHost(MoocWebBrowser.Url.Host); while (cookies.MoveNext()) { var cookie = new CookieModel { CreationTime = cookies.Current?.CreationTime, Expiry = cookies.Current?.Expiry, Host = cookies.Current?.Host, IsDomain = cookies.Current?.IsDomain, IsHttpOnly = cookies.Current?.IsHttpOnly, IsSecure = cookies.Current?.IsSecure, IsSession = cookies.Current?.IsSession, LastAccessed = cookies.Current?.LastAccessed, Name = cookies.Current?.Name, Path = cookies.Current?.Path, RawHost = cookies.Current?.RawHost, Value = cookies.Current?.Value, }; if (Cookies.All(c => c.Name != cookie.Name)) { Cookies.Add(cookie); } } // Close the current window when the cookies is obtained. if (_cookieKeys.Any(key => Cookies.Exists(c => c.Name == key))) { Close(); DialogResult = DialogResult.OK; } }
void WebBrowser_DocumentCompleted(object sender, Gecko.Events.GeckoDocumentCompletedEventArgs e) { _browser.AddMessageEventListener("gridClick", ItemClick); _browser.AddMessageEventListener("gridReordered", GridReordered); SelectPage(_selectedPage); _browser.VerticalScrollDistance = _verticalScrollDistance; }
void web_DienMatKhau(object sender, Gecko.Events.GeckoDocumentCompletedEventArgs e) { btnLogin.Enabled = true; try { web1.DocumentCompleted -= web_DienMatKhau; var _input_Email = web1.Document.GetElementsByName("txtLoginId")[0]; _input_Email.SetAttribute("value", txtUsename.Text); var _input_Pass = web1.Document.GetElementsByName("txtPassword")[0]; _input_Pass.SetAttribute("value", txtPass.Text); GeckoInputElement enter = (GeckoInputElement)web1.Document.GetElementsByTagName("INPUT") .First(inp => ((GeckoInputElement)inp).Value == "Đăng nhập"); enter.Click(); web1.DocumentCompleted += new EventHandler <Gecko.Events.GeckoDocumentCompletedEventArgs>(web_DangNhapThanhCong); var uri = new Uri(URL_LOGIN); //often cookies are stored on domain level, so ".google.com", not "www.google.com" (leading dot is important) string host = uri.Host.Replace("www", ""); var cookies = CookieManager.GetCookiesFromHost(host); while (cookies.MoveNext()) { var c = cookies.Current; cookiesText += c.Name + "=" + c.Value + ";"; } } catch (Exception) { web1.Navigate(URL_LOGIN); } }
private void geckoWebBrowser2_DocumentCompleted(object sender, Gecko.Events.GeckoDocumentCompletedEventArgs e) { if (e.Uri.ToString() != "about:blank") { tabControl1.SelectedTab = tabControl1.TabPages[3]; } }
/// <summary> /// 浏览器文档加载完成回调 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MWebBrowser_DocumentCompleted(object sender, Gecko.Events.GeckoDocumentCompletedEventArgs e) { //启动文档检测定时器 this.brwDocCheckTimer.Enabled = true; //下一步到文档加载定时器回调方法 }
private void geckoWebBrowser1_DocumentCompleted(object sender, Gecko.Events.GeckoDocumentCompletedEventArgs e) { String cUrl = geckoWebBrowser1.Url.AbsoluteUri; if (!LOAD_LAST_FLAG) { if (cUrl.IndexOf("login") > 0) { WebJS js = new WebJS(geckoWebBrowser1.Document); js.setFieldValue("user_id", INIConfig.ReadString("System", "UserID")); js.setFieldValue("user_pass", INIConfig.ReadString("System", "UserPass")); LOAD_LAST_FLAG = true; } } if ((LOAD_LAST_FLAG) && (!LOAD_TOKEN_FLAG)) { if (cUrl.IndexOf("index") > 0) { WebJS js = new WebJS(geckoWebBrowser1.Document); string cUserCode = js.getFieldValue("usercode"); ApplicationEvent.setUserCode(cUserCode); // ApplicationEvent.UserInfo.USER_CODE = cUserCode; string cOrgID = js.getFieldValue("orgid"); //ApplicationEvent.UserInfo.ORG_ID = cOrgID; string cToken = js.getFieldValue("token"); ApplicationEvent.Token = cToken; LOAD_TOKEN_FLAG = true; } } }
private void webBrowser1_DocumentCompleted(object sender, Gecko.Events.GeckoDocumentCompletedEventArgs e) { textBox1.Text = ((GeckoWebBrowser)tabControl1.SelectedTab.Controls[0]).Url.ToString(); tabControl1.SelectedTab.Text = ((GeckoWebBrowser)tabControl1.SelectedTab.Controls[0]).DocumentTitle + " | .Net Open Source Browser"; pictureBox3.Image = Properties.Resources.refresh; nav = false; }
void WebBrowser_DocumentCompleted(object sender, Gecko.Events.GeckoDocumentCompletedEventArgs e) { AddThumbnailListeners(); SelectPage(_selectedPage); // Since we always put this element in and the document is supposed to be completed I don't see how this can not find it, // but it happens, so adding defensive code... _browser.RunJavaScript("if (document.getElementById('pageGridWrapper')) {document.getElementById('pageGridWrapper').scrollTop =" + _verticalScrollDistance + ";}"); }
private void browser_DocumentCompleted(object sender, Gecko.Events.GeckoDocumentCompletedEventArgs e) { if (Controls.Contains(splash)) { spinner.Enabled = false; Controls.Remove(splash); } }
private void geckoWebBrowser1_DocumentCompleted(object sender, Gecko.Events.GeckoDocumentCompletedEventArgs e) { if (stop == false) { stop = true; saatleriYukle(); label2.Text = "yüklendi."; timer1.Enabled = true; } }
private void GeckoWebBrowser_DocumentCompleted(object sender, Gecko.Events.GeckoDocumentCompletedEventArgs e) { if (selectedPattern != null) { try { ChangeDisplayGecko(selectedPattern); } catch { } } }
void web_DangNhapThanhCong(object sender, Gecko.Events.GeckoDocumentCompletedEventArgs e) { if (e.Uri.ToString().IndexOf("https://m.facebook.com/messages/") == 0) { web1.Show(); web1.DocumentCompleted -= web_DangNhapThanhCong; btnLogin.Enabled = false; txtUsename.Enabled = false; txtPass.Enabled = false; btnLogin.Text = "Đã đăng nhập"; } }
void web_DangNhapThanhCong(object sender, Gecko.Events.GeckoDocumentCompletedEventArgs e) { if (e.Uri.ToString().IndexOf("http://220.231.117.235/dkmh/default.asp") == 0) { web1.DocumentCompleted -= web_DangNhapThanhCong; btnLogin.Enabled = false; txtUsename.Enabled = false; txtPass.Enabled = false; btnLogin.Text = "Đã đăng nhập"; btnDk.Visible = true; } }
private void Browser_DocumentCompleted(object sender, Gecko.Events.GeckoDocumentCompletedEventArgs e) { if (CurrentAction != null) { BrowserAction tmpAction = CurrentAction; CurrentAction = null; tmpAction.Invoke(); } else { Console.WriteLine(""); } }
/// <summary> /// Sự kiện khi đăng nhập và chuyển đến trang danh sách tin nhắn /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void web_DangNhapThanhCong(object sender, Gecko.Events.GeckoDocumentCompletedEventArgs e) { if (e.Uri.ToString().IndexOf("https://m.facebook.com/messages") == 0) { web.DocumentCompleted -= web_DangNhapThanhCong; tm_XoaNoiDung.Start(); btnDangNhap.Enabled = false; txtUser.Enabled = false; txtPass.Enabled = false; btnDangNhap.Text = "Đã đăng nhập"; groupDanhSach.Enabled = true; } }
private void Gecko_DocumentCompleted(object sender, Gecko.Events.GeckoDocumentCompletedEventArgs e) { //var executor = new Gecko.JQuery.JQueryExecutor(gecko.Window); //先获取到jquery对象 //executor.ExecuteJQuery("$('#a')"); //然后执行jquery的代码 using (AutoJSContext context = new AutoJSContext(gecko.Window)) { string result; context.EvaluateScript("3 + 2;", out result); context.EvaluateScript("'hello' + ' ' + 'world';", out result); } progressBar1.Value = 0; }
private void geckoWebBrowser1_DocumentCompleted(object sender, Gecko.Events.GeckoDocumentCompletedEventArgs e) { if (geckoWebBrowser1.Document.Title != "QQ空间小助手") { return; } string documentText = this.geckoWebBrowser1.Document.Body.InnerHtml; Regex regex = new Regex("skey=@[a-zA-Z0-9]{9}"); MatchCollection matchCollection = regex.Matches(documentText); for (int i = 0; i < matchCollection.Count; i++) { string text = matchCollection[i].ToString().Replace("skey=", ""); textBox2.Text = Pub.sKey(text); } }
void LayThongTin(object sender, Gecko.Events.GeckoDocumentCompletedEventArgs e) { try { web.DocumentCompleted -= LayThongTin; var _input_Url = web.Document.GetElementsByName("texturl")[0]; _input_Url.SetAttribute("value", txtUrl.Text); var _input_Fomat = web.Document.GetElementById("select_main"); _input_Fomat.SetAttribute("data-value", cbAudioFm.SelectedIndex.ToString()); var _btn_start = (Gecko.DOM.GeckoButtonElement)web.Document.GetElementById("convert1"); _btn_start.Click(); web.DocumentCompleted += new EventHandler <Gecko.Events.GeckoDocumentCompletedEventArgs>(ThanhCong); } catch { } }
private void Web_DocumentCompleted(object sender, Gecko.Events.GeckoDocumentCompletedEventArgs e) { web.DocumentCompleted -= Web_DocumentCompleted; string Help = ""; using (AutoJSContext context = new AutoJSContext(web.Window)) { context.EvaluateScript("document.getElementById('videerlay').click();"); System.Threading.Thread.Sleep(200); context.EvaluateScript("document.getElementsByClassName('vjs-play-control vjs-control vjs-button')[0].click();"); System.Threading.Thread.Sleep(200); context.EvaluateScript("document.getElementById('dogevideo_html5_api').src;", out Help); } web.DocumentCompleted += Web_DocumentCompleted1; web.Invoke(new Action(() => { web.Navigate(Help); })); }
private void geckoWebBrowser_DocumentCompleted(object sender, Gecko.Events.GeckoDocumentCompletedEventArgs e) { //_blank 在新窗口中打开被链接文档。 //_self 默认。在相同的框架中打开被链接文档。 //_parent 在父框架集中打开被链接文档。 //_top 在整个窗口中打开被链接文档。 //framename 在指定的框架中打开被链接文档。 //将所有的链接的目标,指向本窗体 foreach (GeckoHtmlElement archor in this.geckoWebBrowser.Document.Links) { archor.SetAttribute("target", "_self"); } //将所有的FORM的提交目标,指向本窗体 foreach (GeckoHtmlElement form in this.geckoWebBrowser.Document.Forms) { form.SetAttribute("target", "_self"); } }
void webBrowser1_DocumentCompleted(object sender, Gecko.Events.GeckoDocumentCompletedEventArgs e) { if (e.Uri == null) { return; } if (e.Uri.ToString().IndexOf("login.html") != -1) { GeckoDocument doc = webBrowser1.Document; /*GeckoInputElement element = doc.GetElementsByName("nosave_Username").Single() as GeckoInputElement; * element.Value = "admin";*/ GeckoInputElement element = doc.GetElementById("id_nosave_Password") as GeckoInputElement; if (element != null) { element.Value = "password"; element = doc.GetElementById("id_login") as GeckoInputElement; element.Click(); } } if (e.Uri.ToString().IndexOf("index_pc.html") != -1) { webBrowser1.Navigate("http://192.168.0.7/init.html"); } if (e.Uri.ToString().IndexOf("init.html") != -1) { GeckoDocument doc = webBrowser1.Document; GeckoInputElement element = doc.GetElementById("id_rebootBtn") as GeckoInputElement; if (element != null) { element.Click(); Timer timer = new Timer(); timer.Interval = 1000 * 60; timer.Tick += (s, a) => { this.Close(); }; timer.Enabled = true; } } }
private void geckoWebBrowser1_DocumentCompleted(object sender, Gecko.Events.GeckoDocumentCompletedEventArgs e) { Text = "URL: " + geckoWebBrowser1.Url.ToString(); ((Form1)(Application.OpenForms["Form1"])).listBox3.Items.Add("Yönlendirme Tamamlandı. " + geckoWebBrowser1.Url.ToString()); if (geckoWebBrowser1.Document.Head.InnerHtml.Contains("Wrap Long Lines")) { ((Form1)(Application.OpenForms["Form1"])).listBox3.Items.Add("HTTP Bad Request. Tıklama yapılamadı. " + geckoWebBrowser1.Url.ToString() + " PRXY: " + prxy_lstesi[basla - 1]); timer1.Enabled = true; } if (geckoWebBrowser1.Url.ToString().Replace("https", "http") != url.Replace("https", "http")) { timer1.Enabled = true; } if (geckoWebBrowser1.Document.Head.InnerHtml.Contains("| Cloudflare")) { ((Form1)(Application.OpenForms["Form1"])).listBox3.Items.Add("Cloudflare Koruma Sistemi ile karşılaşıldı. URL: " + geckoWebBrowser1.Url.ToString() + " PROXY: " + prxy_lstesi[basla - 1]); timer1.Enabled = true; } }
void web_DienMatKhau(object sender, Gecko.Events.GeckoDocumentCompletedEventArgs e) { btnLogin.Enabled = true; try { web1.DocumentCompleted -= web_DienMatKhau; var _input_Email = web1.Document.GetElementsByName("email")[0]; _input_Email.SetAttribute("value", txtUsename.Text); var _input_Pass = web1.Document.GetElementsByName("pass")[0]; _input_Pass.SetAttribute("value", txtPass.Text); var _btn_login = (Gecko.DOM.GeckoButtonElement)web1.Document.GetElementsByName("login")[0]; _btn_login.Click(); web1.DocumentCompleted += new EventHandler <Gecko.Events.GeckoDocumentCompletedEventArgs>(web_DangNhapThanhCong); } catch { } }
private void browser_DocumentCompleted(object sender, Gecko.Events.GeckoDocumentCompletedEventArgs e) { BlockPopUps(); GetRealUrl(); bool ThereIsUsernameInput = browser.Document.GetElementById("username") != null; if (OnRealDomain && ThereIsUsernameInput) { this.Loader_off(); progbarLoader.Visible = false; lblPercentage.Visible = false; } else if (GotRealHostFromHtml) { browser.Navigate(Data.RealUrl); } else { GetRealUrl(); } }
protected override void OnDocumentCompleted(Gecko.Events.GeckoDocumentCompletedEventArgs e) { base.OnDocumentCompleted(e); try { Func <GeckoDocument, Uri, Boolean> action = flow.Procedure(e.Uri); GeckoElement script = this.Document.CreateElement("script"); script.SetAttribute("type", "text/javascript"); script.TextContent = "window.alert = function(){};"; this.Document.Head.AppendChild(script); if (!action(this.Document, e.Uri)) { flow.End(); Scraper.Exit(); } } catch (Exception ex) { logger.Error(ex.ToString()); Scraper.Exit(); } }
//private void clickAdsenTimer_Tick(object sender, EventArgs e) //{ // //Loop khi reset IP // string[] arrLog = File.ReadAllLines(excutePath + @"\Log\ResetIPFlag.txt"); // if (arrLog.Length > 0 && arrLog[arrLog.Length-1].Equals("NewIP")) // { // System.Threading.Thread.Sleep(3 * 60000); // IPPublic = getPublicIP(); // WriteLog(IPPublic.ToString()); // if (!IPPublic.Equals(IPPublic.ToString())) // { // MessageBox.Show(IPPublic); // } // numberURL = 0; // nsIBrowserHistory historyMan = Xpcom.GetService<nsIBrowserHistory>(Gecko.Contracts.NavHistoryService); // historyMan = Xpcom.QueryInterface<nsIBrowserHistory>(historyMan); // historyMan.RemoveAllPages(); // //clear cache // nsICookieManager CookieMan; // CookieMan = Xpcom.GetService<nsICookieManager>("@mozilla.org/cookiemanager;1"); // CookieMan = Xpcom.QueryInterface<nsICookieManager>(CookieMan); // CookieMan.RemoveAll(); // loop_ViewLinkWithIP(); // } //} private void geckoBrower_DocumentCompleted(object sender, Gecko.Events.GeckoDocumentCompletedEventArgs e) { if (!isFindingURL) { if (geckoBrower.Url.Host.Equals("www.google.com") || geckoBrower.Url.Host.Equals("www.google.co.uk") || geckoBrower.Url.Host.Equals("www.google.co.jp") || geckoBrower.Url.Host.Equals("www.google.nl") || geckoBrower.Url.Host.Equals("www.google.de")) { GeckoElementCollection cv = geckoBrower.Document.GetElementsByTagName("a"); foreach (var item in cv) { //Doanh nghiệp xanh - Diễn đàn cộng đồng doanh nghiệp Việt Nam if (StripHTML(item.InnerHtml).Equals(objAdwordConfig.TextLink)) { isFindingURL = true; System.Threading.Thread.Sleep(20000); WriteLog(StripHTML(item.InnerHtml)); item.Click(); //Tim thay URL can view thi goi timer de click tren trang clickLinkTimer = new Timer(); clickLinkTimer.Interval = (1 * 20 * 1000); clickLinkTimer.Tick += new EventHandler(clickLinkTimer_Tick); clickLinkTimer.Start(); break; } } if (cv.Length > 0 && !isFindingURL) { page = page + 1; string googleUri = geckoBrower.Url.ToString(); int paraStart = 10 * page; //System.Threading.Thread.Sleep(10000); geckoBrower.Navigate(googleUri + "&start=" + paraStart.ToString()); } } } }
/// <summary> /// Thao tác điền tài khoản và mật khẩu vào chương trình /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void web_DienMatKhau(object sender, Gecko.Events.GeckoDocumentCompletedEventArgs e) { btnDangNhap.Enabled = true; try { web.DocumentCompleted -= web_DienMatKhau; var _input_Email = web.Document.GetElementsByName("email")[0]; _input_Email.SetAttribute("value", txtUser.Text); var _input_Pass = web.Document.GetElementsByName("pass")[0]; _input_Pass.SetAttribute("value", txtPass.Text); var _btn_login = (Gecko.DOM.GeckoButtonElement)web.Document.GetElementsByName("login")[0]; _btn_login.Click(); web.DocumentCompleted += new EventHandler <Gecko.Events.GeckoDocumentCompletedEventArgs>(web_DangNhapThanhCong); } catch (Exception) { web.Navigate("https://m.facebook.com/messages/"); } }
void WebBrowser_DocumentCompleted(object sender, Gecko.Events.GeckoDocumentCompletedEventArgs e) { _browser.AddScriptSource("jquery-1.10.1.js"); _browser.AddScriptSource("form2object.js"); _browser.AddScriptSource("js2form.js"); _browser.AddScriptSource("underscore.js"); _browser.AddScriptContent( @"function gatherSettings() { var formData = form2object('form', '.', false, null); document.getElementById('output').innerHTML = JSON.stringify(formData, null, '\t'); } function preloadSettings() { x = " + _libraryJsonData + @"; var $inputs = $('#form').find('[name]'); populateForm($inputs, x, 'name'); }" ); //if we have saved data from a previous run, prepopulate the form with that _browser.RunJavaScript("preloadSettings()"); //nb: if this starts removing the defaults, it means we've lost the patch: if(valForForm != null) on line 80 of jsform.js }
void WebBrowser_DocumentCompleted(object sender, Gecko.Events.GeckoDocumentCompletedEventArgs e) { AddThumbnailListeners(); SelectPage(_selectedPage); _browser.VerticalScrollDistance = _verticalScrollDistance; }
private void geckoWebBrowser1_DocumentCompleted(object sender, Gecko.Events.GeckoDocumentCompletedEventArgs e) { documentx = geckoWebBrowser1.Document; toolStripTextBox1.Text = e.Uri.ToString(); }