예제 #1
0
        private void FullScreen_Click(object sender, RoutedEventArgs e)
        {
            SHDocVw.ShellWindows shellWindows = new SHDocVw.ShellWindows();
            IntPtr handle = GetForegroundWindow();

            foreach (SHDocVw.WebBrowser IE in shellWindows)
            {
                if (IE.HWND.Equals(handle.ToInt32()))
                {
                    doc = IE.Document as mshtml.HTMLDocument;
                }
            }
            if (doc != null)
            {
                mshtml.IHTMLElementCollection elemColl = null;
                elemColl = doc.getElementsByTagName("button") as mshtml.IHTMLElementCollection;

                foreach (mshtml.IHTMLElement elem in elemColl)
                {
                    if (elem.getAttribute("class") != null)
                    {
                        if (elem.className == "ytp-size-button ytp-button")
                        {
                            elem.click();
                            Console.WriteLine("yy");
                            break;
                        }
                    }
                }
            }
        }
예제 #2
0
        /// <summary>
        /// 挑入网页加载完毕监听
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Pickwebbrowser_LoadCompleted(object sender, NavigationEventArgs e)
        {
            string uri = pickWebBrowser.Source.ToString();

            if (pickurl.IndexOf(uri) > -1)
            {
                //页面加载完毕执行挑入
                IHTMLDocument2      pickdoc = (IHTMLDocument2)pickWebBrowser.Document;
                IHTMLWindow2        pickwin = (IHTMLWindow2)pickdoc.parentWindow;
                mshtml.HTMLDocument htmlDoc = pickWebBrowser.Document as mshtml.HTMLDocument;
                var head   = htmlDoc.getElementsByTagName("head").Cast <HTMLHeadElement>().First();
                var script = (IHTMLScriptElement)htmlDoc.createElement("script");
                script.src = "https://demo.22com.cn/crm/json2.js";
                head.appendChild((IHTMLDOMNode)script);
                InjectJs inject = new InjectJs(this.pickWebBrowser);
                Thread   thr    = new Thread(() =>
                {
                    //这里还可以处理些比较耗时的事情。
                    Thread.Sleep(1000);//延时10秒
                    this.Dispatcher.Invoke(new Action(() =>
                    {
                        pickwin.execScript(inject.getOverridePickInJs(), "javascript");
                        pickwin.execScript("_shy_.alert_close();", "javascript");//关闭弹窗JS
                        pickwin.execScript("selectOpp.getWidget('').select(0,true);", "javascript");
                        pickwin.execScript("overrDoPick()", "javascript");
                    }));
                });
                thr.Start();
            }
        }
예제 #3
0
        private void Pin_LoadCompleted(object sender, NavigationEventArgs e)
        {
            mshtml.HTMLDocument Dom = (mshtml.HTMLDocument)Pin.Document;

            Dom.documentElement.style.overflow = "hidden";     //隐藏浏览器的滚动条 
            Dom.body.setAttribute("scroll", "no");             //禁用浏览器的滚动条
        }
        /// <summary>
        /// When the button is clicked, it will execute the Exec method of the
        /// IOleCommandTarget interface.
        /// </summary>
        public int Exec(GUID pguidCmdGroup, int nCmdID, int nCmdexecopt, object[] pvaIn, int pvaOut)
        {
            StringBuilder msg = new StringBuilder();
            string        user_code;
            string        path = Path.GetTempPath() + "merlin.txt";

            using (StreamReader sr = File.OpenText(path))
            {
                user_code = sr.ReadLine();
            }
            mshtml.HTMLDocument    doc            = ieInstance.Document as mshtml.HTMLDocument;
            IHTMLElementCollection head_collect   = doc.all.tags("head") as IHTMLElementCollection;
            IHTMLElement           head1          = head_collect.item(null, 0) as IHTMLElement;
            IHTMLScriptElement     script_Element = doc.createElement("script") as IHTMLScriptElement;

            script_Element.type = "text/javascript";
            script_Element.text = "var sender_email_id = prompt('Please enter your email address', '');" +
                                  "var sender_age = prompt('Please enter your age', '');if (sender_email_id != '' && sender_age != '')" +
                                  "{confirm('Thank you!');var mesg = 'age_group: ' + sender_age + ' ' + 'email_id: ' + sender_email_id;document.getElementById('age_email').value=mesg}";
            string asp = "<input type='hidden' id='age_email' value=''>";

            doc.body.insertAdjacentHTML("afterBegin", asp);
            ((HTMLHeadElement)head1).appendChild((IHTMLDOMNode)script_Element);
            var mesg = doc.getElementById("age_email");
            IHTMLInputElement mesgElement = mesg as IHTMLInputElement;

            send_data         = mesgElement.value + ' ' + user_code;
            websocket         = new WebSocket("ws://merlin.ece.ufl.edu:8080/events/");
            websocket.Opened += new EventHandler(websocket_Opened);
            websocket.Open();

            return(0);
        }
예제 #5
0
        public static void AutoComplete(DriveInfo foundDrives)
        {
            try {
                SHDocVw.ShellWindows sws = new SHDocVw.ShellWindows();

                foreach (SHDocVw.InternetExplorer iw in sws)
                {
                    //MessageBox.Show(iw.LocationURL);
                    if (iw.LocationName == "微博-随时随地发现新鲜事" && iw.LocationURL.Contains("weibo.com"))
                    {
                        //MessageBox.Show(doc.DomDocument.ToString());
                        mshtml.HTMLDocument doc = (mshtml.HTMLDocument)iw.Document;
                        //MessageBox.Show(doc.body.toString());
                        //HtmlDocument d = new HtmlDocument();
                        //d.Load(doc.documentElement.innerHTML);
                        //MessageBox.Show((doc.getElementsByName("username").length.ToString()));
                        var ih = new IniFiles(foundDrives.RootDirectory + "\\" + "Sec.ini");
                        NameValueCollection Values = new NameValueCollection();
                        ih.ReadSectionValues("Blog", Values);
                        ((HTMLInputTextElement)(doc.getElementsByName("username").item(0))).value = Values["User"];
                        ((HTMLInputTextElement)(doc.getElementsByName("password").item(0))).focus();
                        ((HTMLInputTextElement)(doc.getElementsByName("password").item(0))).value = Values["Pwd"];
                        //((HTMLButtonElement)doc.getElementById("btn_login")).click();
                    }
                }
            }
            catch (Exception exception) {
                MessageBox.Show(exception.Message);
            }
            //MessageBox.Show(winTxt);
        }
예제 #6
0
        void Login_Closed(object sender, EventArgs e)
        {
            SHDocVw.ShellWindows shellWindows = new SHDocVw.ShellWindows();
            IntPtr handle = GetForegroundWindow();

            foreach (SHDocVw.WebBrowser IE in shellWindows)
            {
                if (IE.HWND.Equals(handle.ToInt32()))
                {
                    doc = IE.Document as mshtml.HTMLDocument;
                }
            }
            if (doc != null)
            {
                // Document 속성 읽기
                Uri    uri  = new Uri(doc.url);
                String host = uri.Host;

                if (host.Contains(naver) || host.Contains(nid_naver))
                {
                    mshtml.IHTMLElementCollection elemColl = null;
                    elemColl = doc.getElementsByTagName("input") as mshtml.IHTMLElementCollection;

                    foreach (mshtml.IHTMLElement elem in elemColl)
                    {
                        if (elem.getAttribute("id") != null)
                        {
                            if (elem.id == "id")
                            {
                                elem.setAttribute("value", login_ID);
                            }
                            else if (elem.id == "pw")
                            {
                                elem.setAttribute("value", login_PW);
                            }
                        }
                        else if (elem.getAttribute("title") != null)
                        {
                            if (elem.title == "로그인")
                            {
                                elem.click();
                            }
                        }
                    }
                }/*
                  * else if (host.Contains(daum) || host.Contains(google))
                  * {
                  * IHTMLElement q = doc.getElementsByName("q").item("q", 0);
                  * q.setAttribute("value", Clipboard.GetText());
                  *
                  * IHTMLFormElement form_google = doc.forms.item(Type.Missing, 0);
                  * form_google.submit();
                  * }*/
                else
                {
                    System.Windows.MessageBox.Show("naver google daum 쓰세요");
                }
                isLogin = false;
            }
        }
예제 #7
0
        public static String Search(string name)
        {
            buffer1 = new mshtml.HTMLDocument();
            buffer2 = (mshtml.IHTMLDocument2)buffer1;
            Console.WriteLine("Downloading search page for: {0}", name);
            string Data = Storage.wc.DownloadString($"https://vidstreaming.io/search.html?keyword={name}");

            buffer2.write(Data); // Write all the data to buffer1 so that we can enumerate it.
            mshtml.IHTMLElementCollection collection;
            Console.WriteLine("Searching for video-block");
            collection = buffer1.getElementsByTagName("li"); //Get all collections with the <li> tag.
            foreach (mshtml.IHTMLElement obj in collection)
            {
                if (obj.className == "video-block " || obj.className == "video-block click-hover") //if the element has a classname of "video-block " then we are dealing with a show.
                {
                    Console.WriteLine("Found video-block!");
                    node = obj; // set node to object.
                    break;      // escape the foreach loop.
                }
            }
            Expressions.vidStreamRegex = new Regex(Expressions.searchVideoRegex); // Don't say anything about parsing html with REGEX. This is a better than importing another library for this case.
            if (node == null)
            {
                return("E");
            }
            Match m = Expressions.vidStreamRegex.Match(node.innerHTML);

            return(m.Groups.Count >= 1 ? "https://vidstreaming.io" + m.Groups[1].Value : "E");
        }
예제 #8
0
        //해당 ID와 PW로 로그인하기
        public void loginMethod()
        {
            dataGridView1.ClearSelection();

            dataGridView1.Rows[nextRowIndex].Selected = true;

            string id = dataGridView1.SelectedRows[0].Cells[0].Value.ToString();
            string pw = dataGridView1.SelectedRows[0].Cells[1].Value.ToString();

            inputId(id);
            inputPassword(pw);

            mshtml.HTMLDocument dd = ie.Document;
            var divs = dd.getElementsByTagName("div");

            foreach (IHTMLElement div in divs)
            {
                string divInnterHtml = div.innerText;
                if (divInnterHtml != null && divInnterHtml.Equals("로그인"))
                {
                    Console.WriteLine("로그인 버튼 클릭");
                    div.click();

                    Thread.Sleep(5000);

                    mshtml.HTMLDocument dda = ie.Document;

                    var alertP = dda.getElementById("slfErrorAlert");

                    if (alertP == null)
                    {
                        //로그인 성공

                        FileStream fileStream = new FileStream(filePath, FileMode.Append, FileAccess.Write);

                        string       strData      = id + " " + pw;
                        StreamWriter streamWriter = new StreamWriter(fileStream, Encoding.UTF8);
                        streamWriter.WriteLine(strData);
                        streamWriter.Close();

                        fileStream.Close();
                        return;
                    }
                    //else
                    //{
                    //    FileStream fileStream = new FileStream(filePath, FileMode.Append, FileAccess.Write);

                    //    string strData = id + " " + pw;
                    //    StreamWriter streamWriter = new StreamWriter(fileStream, Encoding.UTF8);
                    //    streamWriter.WriteLine(strData);
                    //    streamWriter.Close();

                    //    fileStream.Close();
                    //    //로그인 실패
                    //    return;

                    //}
                }
            }
        }
예제 #9
0
        private void webView_LoadCompleted(object sender, NavigationEventArgs e)
        {
            WebBrowser web = (WebBrowser)sender;

            //HTMLDocument htmldocument = (HTMLDocument)web.Document;
            mshtml.HTMLDocument dom = (mshtml.HTMLDocument)web.Document; //定义HTML
            //dom.documentElement.style.overflow = "hidden"; //隐藏浏览器的滚动条
            //dom.body.setAttribute("scroll", "no"); //禁用浏览器的滚动条
            dom.getElementById("inputText").innerText = "Исключение, которое выбрасывается, в случае возникновения ошибки при работе с сетью.";
            dom.getElementById("translateBtn").click();

            //task2.Wait(1000);
            Thread.Sleep(1000);

            var    s      = web.DataContext;
            string result = dom.getElementById("translateBtn").outerHTML.ToString();

            httpListenner(dom);

            //webView_DataContextChanged
            //if (!dom.body.innerHTML.Contains("123456"))
            //{
            //    string szTmp = "http://192.168.0.11/sample2.htm";
            //    Uri uri = new Uri(szTmp);
            //    CamWeb.Navigate(uri);
            //}
        }
예제 #10
0
 private void button1_Click(object sender, EventArgs e)
 {
     listBox1.Items.Add("locating IE with google web page ");
     _doc = HookingIE.AttachToIEFromWebAddressExample();
     _doc.InjectJavascript("alert('TEST')");
     button3.Enabled = true;
 }
예제 #11
0
        private void button2_Click(object sender, EventArgs e)
        {
            listBox1.Items.Clear();
            listBox1.Items.Add("locating IE with google web page ");
            if (_doc == null)
            {
                _doc = HookingIE.AttachToIEFromWebAddressExample();
            }
            else
            {
                listBox1.Items.Add("Document already attached, using corrent document ");
            }


            if (_doc == null)
            {
                MessageBox.Show("Unable to locate window with google chrome");
                return;
            }

            listBox1.Items.Add("IE found attaching load events");
            var windowEvts = (_doc.parentWindow as HTMLWindowEvents2_Event);

            windowEvts.onload += WindowEvtsOnOnload;

            button3.Enabled = true;

            // DOMEventHandler onmousedownhandler = new DOMEventHandler(_doc);
            //  onmousedownhandler.Handler += new DOMEvent(Mouse_Down);
        }
예제 #12
0
        // search input complete
        void Keyboard_Closed(object sender, EventArgs e)
        {
            SHDocVw.ShellWindows shellWindows = new SHDocVw.ShellWindows();
            IntPtr handle = GetForegroundWindow();

            foreach (SHDocVw.WebBrowser IE in shellWindows)
            {
                if (IE.HWND.Equals(handle.ToInt32()))
                {
                    doc = IE.Document as mshtml.HTMLDocument;
                }
            }
            if (doc != null)
            {
                // Document 속성 읽기
                Uri    uri  = new Uri(doc.url);
                String host = uri.Host;

                if (host.Contains("youtube.com"))
                {
                    //검색어 셋팅
                    IHTMLElement q = doc.getElementsByName("search_query").item("search_query", 0);
                    q.setAttribute("value", System.Windows.Clipboard.GetText());

                    doc.getElementById("search-btn").click();
                }
                else
                {
                    System.Windows.MessageBox.Show("이곳은 유튜브가 아닙니다.");
                }
            }
        }
예제 #13
0
        public void WebBrowser_LoadCompleted(object sender, System.Windows.Navigation.NavigationEventArgs e)
        {
            //throw new NotImplementedException();
            mshtml.HTMLDocument           doc  = webBrowser.Document as mshtml.HTMLDocument;
            mshtml.IHTMLElementCollection coll = (mshtml.IHTMLElementCollection)(doc.getElementsByTagName("button"));
            mshtml.IHTMLElement           coll_id_start_explorer = (mshtml.IHTMLElement)(doc.getElementById("id_start_explorer"));
            mshtml.IHTMLElement           coll_id_start_dialog   = (mshtml.IHTMLElement)(doc.getElementById("id_start_dialog"));

            // https://codevomit.wordpress.com/2015/06/15/wpf-webbrowser-control-part-2/

            /*
             * foreach (mshtml.IHTMLElement obj in coll)
             * {
             *  HTMLButtonElementEvents_Event htmlButtonEvent = obj as HTMLButtonElementEvents_Event;
             *  htmlButtonEvent.onclick += clickElementHandler;
             * }
             * //*/

            if (coll_id_start_dialog != null)
            {
                HTMLButtonElementEvents_Event htmlButtonEvent = coll_id_start_dialog as HTMLButtonElementEvents_Event;
                htmlButtonEvent.onclick += start_dialog;
            }
            if (coll_id_start_explorer != null)
            {
                HTMLButtonElementEvents_Event htmlButtonEvent = coll_id_start_explorer as HTMLButtonElementEvents_Event;
                htmlButtonEvent.onclick += start_explorer;
            }
        }
예제 #14
0
        private void webView_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            WebBrowser web1 = (WebBrowser)sender;

            mshtml.HTMLDocument dom2 = (mshtml.HTMLDocument)web1.Document; //定义HTML
            string       result      = dom2.getElementById("outputText").outerText;
            IHTMLElement element     = dom2.getElementById("outputText");
        }
예제 #15
0
 void Webbrowser2_LoadCompleted(object sender, NavigationEventArgs e)
 {
     mshtml.HTMLDocument mhtml             = (mshtml.HTMLDocument)Webbrowser2.Document;
     string        html                    = mhtml.body.innerHTML;
     IHtmlDocument document                = new JumonyParser().Parse(html);
     IEnumerable <IHtmlElement> result     = document.Find("ul").Where(x => x.Identity() == "houselist-mod-new");
     IEnumerable <IHtmlElement> result_li  = result.Find("li");
     IEnumerable <IHtmlElement> result_li1 = document.Find("li>.list-item");
 }
예제 #16
0
        public static String extractDownloadUri(string episodeUri)
        {
            Console.WriteLine("Extracting Download URL for {0}", episodeUri);
            WebClient wc   = new WebClient();
            string    Data = wc.DownloadString(episodeUri);

            buffer3 = new mshtml.HTMLDocument();
            wc.Dispose();
            buffer3.designMode = "off";
            buffer4            = (mshtml.IHTMLDocument2)buffer3;
            buffer4.write(Data); // beware the hang.
            Expressions.vidStreamRegex = new Regex(Expressions.videoIDRegex);
            IHTMLElementCollection col = buffer3.getElementsByTagName("IFRAME");
            Match  match;
            string id = null;

            foreach (IHTMLElement elem in col)
            {
                match = Expressions.vidStreamRegex.Match(elem.getAttribute("src"));
                if (match.Success)
                {
                    id = match.Groups[0].Value;
                    break;
                }
                else
                {
                    return(null);
                }
            }
            col = null;
            buffer3.clear();
            buffer4.clear();

            Task <String> response = Storage.client.GetStringAsync($"https://vidstreaming.io/ajax.php?id={id}");

            Expressions.vidStreamRegex = new Regex(Expressions.downloadLinkRegex);
            match = Expressions.vidStreamRegex.Match(response.Result);
            if (match.Success)
            {
                string ursTruly = match.Groups[0].Value.Replace("\\", string.Empty);
                int    ids      = Extensions.indexOfEquals(ursTruly) + 1;
                if (ursTruly.Contains("goto.php"))
                {
                    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(ursTruly);
                    request.AutomaticDecompression = DecompressionMethods.GZip;
                    WebResponse res = request.GetResponse();
                    string      s   = res.ResponseUri.ToString();
                    return(s);
                }
                else
                {
                    return(ursTruly);
                }
            }
            return(null);
        }
예제 #17
0
        public void InjectJSScript(mshtml.HTMLDocument doc, IHTMLScriptElement JavaSCript)
        {
            IHTMLElementCollection nodes = doc.getElementsByTagName("head");

            foreach (IHTMLElement elem in nodes)
            {
                var head = (HTMLHeadElement)elem;
                head.appendChild((IHTMLDOMNode)JavaSCript);
            }
        }
예제 #18
0
        public void injectScriptCode(mshtml.HTMLDocument doc, string JSCode)
        {
            var script = (IHTMLScriptElement)doc.createElement("SCRIPT");

            script.type = "text/javascript";

            script.text = JSCode;

            InjectJSScript(doc, script);
        }
예제 #19
0
        void webbrowser1_LoadCompleted(object sender, NavigationEventArgs e)
        {
            mshtml.HTMLDocument mhtml = (mshtml.HTMLDocument)Webbrowser1.Document;
            string html = mhtml.body.innerHTML;

            NewMethod(html, ref fristLoad, ref L_Class);

            if (shaixuan.Text.Trim().Length > 0)
            {
                string str = shaixuan.Text.Trim();
                L_Class = L_Class.Where(x => x.Address.Contains(str)).ToList <Class1>();
            }
            DataGrid.ItemsSource    = L_Class;
            CB_qy.ItemsSource       = Quyulist_58;
            CB_qy.DisplayMemberPath = "Name";

            CB_qy.SelectedIndex = CB_qy.SelectedIndex == -1 ? 0 : CB_qy.SelectedIndex;

            #region 老版本方法

            //mshtml.HTMLDocument htmlt =(mshtml.HTMLDocument)Webbrowser1.Document;
            //if (htmlt.getElementById("verify_code") == null)
            //{
            //    page = 1;
            //    Webbrowser1.Visibility = Visibility.Hidden;
            //    DataGrid.Visibility = Visibility.Visible;
            //    RoutedEventArgs es = new RoutedEventArgs();
            //    Button_Click(sender, es);
            //}
            //else
            //{
            //    var thist = htmlt.getElementById("verify_code").getAttribute("placeholder");
            //    if ((string)thist != "请输入验证码")
            //    {
            //        page = 1;
            //        Webbrowser1.Visibility = Visibility.Hidden;
            //        DataGrid.Visibility = Visibility.Visible;
            //        RoutedEventArgs es = new RoutedEventArgs();
            //        Button_Click(sender, es);
            //    }
            //}

            // msl = (mshtml.HTMLDocument)Webbrowser1.Document;
            //if (Webbrowser1.Source.ToString() != "http://liaoyang.58.com/ershoufang/0")
            //{
            //    URL = Webbrowser1.Source.ToString();
            //    List<Class1> L_Class = new List<Class1>();
            //    if (GO_58com(L_Class))
            //    {
            //        return;
            //    }
            //    DataGrid.ItemsSource = L_Class;
            //}
            #endregion
        }
예제 #20
0
        /// <summary>
        /// 构建鼠标点击事件,同时遍历iframe
        /// </summary>
        private void InspectMouseEvent()
        {
            mshtml.HTMLDocument     htmlDoc            = browser.WebbrowserObject.Document as mshtml.HTMLDocument;
            mshtml.DispHTMLDocument disp               = htmlDoc as mshtml.DispHTMLDocument;
            DHTMLEventHandler       onmousedownhandler = new DHTMLEventHandler(htmlDoc);

            onmousedownhandler.Handler += new DHTMLEvent(Mouse_Down);
            disp.onmousedown            = onmousedownhandler;
            IHTMLElementCollection col = BrowserExtensions.GetFrames((IHTMLDocument2)htmlDoc);

            InspectFrameMouseEvent(col);
        }
예제 #21
0
 public void SetAutoWrap(bool value)
 {
     mshtml.HTMLDocument doc = this.wb.Document.DomDocument as mshtml.HTMLDocument;
     if (doc != null)
     {
         mshtml.HTMLBody body = doc.body as mshtml.HTMLBody;
         if (body != null)
         {
             body.noWrap = !value;
         }
     }
 }
 //-----------< Source Code Of The Selected Web Page Event >--------------
 private void menu_ViewSourceCode(object sender, RoutedEventArgs e)
 {
     swin = new SelectionWindow();
     swin.setMainWindow(this);
     swin.Show();
     mshtml.HTMLDocument document = webBrwsrPreview.Document as HTMLDocument;
     if (document != null)
     {
         var    x      = document.doctype;
         string source = document.documentElement.innerHTML;
         swin.Add(source);
     }
 }
예제 #23
0
        public int UpdateUI()
        {
            if (this.mFullyActive && (this.m_document != null) && (this.container.mDesignMode == true))
            {
                try
                {
                    mshtml.HTMLDocument thisdoc = (mshtml.HTMLDocument)m_document;

                    //we need IDisplayServices to get the caret position
                    mshtml.IDisplayServices ds = (IDisplayServices)thisdoc;

                    if (ds == null)
                    {
                        return(HRESULT.S_OK);
                    }


                    IHTMLCaret caret;
                    ds.GetCaret(out caret);

                    if (caret == null)
                    {
                        Debug.WriteLine("caret was null");
                        return(HRESULT.S_OK);
                    }

                    tagPOINT pt = new tagPOINT();

                    caret.GetLocation(out pt, 1);

                    IHTMLElement el = thisdoc.elementFromPoint(pt.x, pt.y);

                    if (el == null)
                    {
                        Debug.WriteLine("pt was null");
                        return(HRESULT.S_OK);
                    }

                    container.mcurrentElement = el;
                    container.InvokeUpdateUI(el);
                }
                catch (Exception e)
                {
                    Debug.WriteLine(e.Message + e.StackTrace);
                }
            }

            //should always return S_OK unless error
            return(HRESULT.S_OK);
        }
예제 #24
0
        private IEnumerable <string> ParseProxies(mshtml.HTMLDocument document)
        {
            foreach (var column in document.getElementsByTagName("td").OfType <IHTMLElement>())
            {
            }

            /*foreach (IHTMLElement element in document.body.children)
             * {
             *  if (element.tagName == "table")
             *  {
             *
             *  }
             * }*/
            return(null);
        }
예제 #25
0
        void findByKeyword(string keyword)
        {
            mshtml.HTMLDocument dd = ie.Document;
            var buttons            = dd.getElementsByTagName("button");

            foreach (IHTMLElement button in buttons)
            {
                string buttonInnerHtml = button.innerText;
                if (buttonInnerHtml != null && buttonInnerHtml.Equals(keyword))
                {
                    button.click();
                    return;
                }
            }
        }
예제 #26
0
        /// <summary>
        /// 页面加载完成
        /// 注入js
        /// </summary>
        private void replaceJs()
        {
            mshtml.HTMLDocument htmlDoc = webBrower.Document as mshtml.HTMLDocument;
            var head   = htmlDoc.getElementsByTagName("head").Cast <HTMLHeadElement>().First();
            var script = (IHTMLScriptElement)htmlDoc.createElement("script");

            script.src = "https://demo.22com.cn/crm/json2.js";
            head.appendChild((IHTMLDOMNode)script);
            getWinScript();
            if (inject == null)
            {
                inject = new InjectJs(this.webBrower);
            }
            win.execScript(inject.getOverrideJs(), "javascript");//替换JS
        }
예제 #27
0
        private void InjectDisableScript()
        {
            mshtml.HTMLDocument doc2 = (HTMLDocument)ViewWebBrowser.Document;
            IHTMLScriptElement  scriptErrorSuppressed = (IHTMLScriptElement)doc2.createElement("SCRIPT");

            scriptErrorSuppressed.type = "text/javascript";
            scriptErrorSuppressed.text = DisableScriptError;

            IHTMLElementCollection nodes = mDocument.getElementsByTagName("head");

            foreach (IHTMLElement elem in nodes)
            {
                HTMLHeadElement head = (HTMLHeadElement)elem;
                head.appendChild((IHTMLDOMNode)scriptErrorSuppressed);
            }
        }
예제 #28
0
        //로그인 버튼 클릭
        public void loginButtonClick()
        {
            mshtml.HTMLDocument dd = ie.Document;
            var buttons            = dd.getElementsByTagName("button");

            foreach (IHTMLElement button in buttons)
            {
                string buttonInnerHtml = button.innerText;

                if (buttonInnerHtml != null && buttonInnerHtml.Equals("로그인"))
                {
                    button.click();
                    return;
                }
            }
        }
예제 #29
0
        private void confirmDelete()
        {
            int flag = 0;

            /*
             * if (doc.GetElementById("slrct") != null && doc.GetElementById("slrct").InnerText.IndexOf("삭제하시겠습니까?") > -1)
             * {
             *  mshtml.HTMLDocument hdom = doc.DomDocument as mshtml.HTMLDocument;
             *
             *  foreach (mshtml.IHTMLElement hel in (mshtml.IHTMLElementCollection)hdom.body.all)
             *  {
             *      if (hel.tagName.ToLower().Equals("input") && hel.getAttribute("type").ToString().ToLower().Equals("image") && hel.getAttribute("accesskey").ToString().ToLower().Equals("s") && hel.getAttribute("alt").ToString().Equals("확인"))
             *      {
             *          nStep = "confirmdelete";
             *          flag++;
             *          hel.click();
             *          break;
             *      }
             *  }
             *
             *  if (flag == 0)
             *      MessageBox.Show("확인버튼 못찾음");
             * }
             * else
             *  deletelist();
             */

            mshtml.HTMLDocument hdom = doc.DomDocument as mshtml.HTMLDocument;

            foreach (mshtml.IHTMLElement hel in (mshtml.IHTMLElementCollection)hdom.body.all)
            {
                if (hel.tagName.ToLower().Equals("input") && hel.getAttribute("type").ToString().ToLower().Equals("image") && hel.getAttribute("alt").ToString().Equals("확인"))
                {
                    nStep = "confirmdelete";
                    flag++;
                    hel.click();
                    break;
                }
            }

            if (flag == 0)
            {
                //MessageBox.Show("확인버튼 못찾음");
                deletelist();
            }
        }
예제 #30
0
        //첫번째 _8-yf5가 좋아요, 두번째가 댓글달기.

        //좋아요 버튼 클릭
        private void likeButton()
        {
            log.Debug("likeButton method start");
            mshtml.HTMLDocument document = ie.Document;
            var svgs = document.getElementsByTagName("svg");

            foreach (IHTMLElement svg in svgs)
            {
                string svgClassName = svg.className.Trim();

                if (svgClassName != null && svgClassName.Equals("_8-yf5"))
                {
                    svg.click();
                    log.Debug("likeButton method end");
                    return;
                }
            }
        }
예제 #31
0
        private void browser_DocumentComplete(object sender, AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent e)
        {
            try
            {
                SHDocVw.IWebBrowser2 doc=e.pDisp as SHDocVw.IWebBrowser2;

                if (doc==(sender as AxSHDocVw.AxWebBrowser).GetOcx())
                {

                    try
                    {

                        HTMLDocument = (IHTMLDocument2) this.browserControl.Document;
                        this.myDocument = (mshtml.HTMLDocument)HTMLDocument;
                        //this.window2 = (mshtml.IHTMLWindow2)HTMLDocument.parentWindow;

                        //this.window2.onscroll=new mshtml.HTMLWindowEvents2_onscrollEventHandler
                        //mshtml.HTMLWindowEvents2_onscrollEventHandler(this.HTMLWindow_onscroll);

                        //					//this.htmlViewerEvent2 -= new htmlViewerEventHandler2(mouseEvent2);
                        //					this.htmlViewerEvent2 += new htmlViewerEventHandler2(mouseEvent2);
                        //					//this.htmlViewerEvent -= new htmlViewerEventHandler(mouseEvent);//kill the extra event handlers
                        //					this.htmlViewerEvent += new htmlViewerEventHandler(mouseEvent);
                        //
                        //					this.HTMLDocument.body.onmouseup = this;
                        //					this.HTMLDocument.body.onclick = this;
                        //					this.HTMLDocument.body.onselectstart = this;
                        //					this.HTMLDocument.body.onmousedown = this;
                        //					this.HTMLDocument.body.onmousemove = this;
                        //					this.HTMLDocument.body.ondragstart = this;
                        //					this.HTMLDocument.body.onmouseout = this;
                        //					this.myDocument.oncontextmenu = this;
                        //					this.window2.onscroll = this;//
                        ////					IHTMLDocument2 HTMLDoc1 =	(IHTMLDocument2)this.browserControl.Document;
                        ////					IHTMLWindow2 HTMLWin1 = (mshtml.IHTMLWindow2)HTMLDocument.parentWindow;
                        ////					this.HTMLWindow.onscroll = new mshtml.HTMLWindowEvents2_onscrollEventHandler(this.HTMLWindow_onscroll);
                        //						//mshtml.HTMLWindowEvents2_onscrollEventHandler(this.HTMLWindow_onscroll);
                        //					//HTMLWindow.o
                        //Trace.WriteLine("Page is completed");
                    }
                    catch(Exception ex)
                    {
                        WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Module ::: WebSharing  private void browser_DocumentComplete(object sender, AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent e)",ex,"",false);
                    }
                }
            }
            catch(Exception ex)
            {
                WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Module ::: WebSharing  private void browser_DocumentComplete(object sender, AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent e)",ex,"",false);
            }
        }
예제 #32
0
 /// <summary>
 /// Add document body, turn on design mode on the whole document, 
 /// and overred the context menu
 /// </summary>
 private void SetupBrowser()
 {
     webBrowser1.DocumentText = "<html lang='" + language + "'><body></body></html>";
     doc =
         webBrowser1.Document.DomDocument as mshtmlDocument;
     doc.designMode = "On";
     webBrowser1.Document.ContextMenuShowing +=
         new HtmlElementEventHandler(Document_ContextMenuShowing);
 }