Beispiel #1
0
        public string getChoseOption(HtmlElement elem)
        {
            HtmlElementCollection optionCollection = elem.GetElementsByTagName("option");

            foreach (HtmlElement OptionElem in optionCollection)
            {
                if (OptionElem.GetAttribute("selected") == "True")
                {
                    return(OptionElem.GetAttribute("value"));
                }
            }
            return("");
        }
Beispiel #2
0
//----------------------OPTIONS----------------------
        public void set_options_elem(HtmlElement elem, string option_name)
        {
            HtmlElementCollection optionCollection = elem.GetElementsByTagName("option");

            foreach (HtmlElement OptionElem in optionCollection)
            {
                if (OptionElem.InnerText == option_name)
                {
                    OptionElem.SetAttribute("selected", "selected");
                    break;
                }
            }
            optionCollection[0].SetAttribute("selected", null);
        }
Beispiel #3
0
        public void set_options(string inner_text)
        {
            HtmlElementCollection collect = webBrowser.Document.GetElementsByTagName("select");

            foreach (HtmlElement selectElem in collect)
            {
                if (selectElem.InnerHtml.IndexOf(inner_text) > 0)
                {
                    HtmlElementCollection optionCollection = selectElem.GetElementsByTagName("option");
                    foreach (HtmlElement OptionElem in optionCollection)
                    {
                        if (OptionElem.InnerText == inner_text)
                        {
                            OptionElem.SetAttribute("selected", "selected");
                            break;
                        }
                    }
                    optionCollection[0].SetAttribute("selected", null);
                    break;
                }
            }
        }