Example #1
0
        private HtmlScreenElementBase CreateInputElement(System.Windows.Forms.HtmlElement argElement)
        {
            Debug.Assert(null != argElement);

            string format = argElement.GetAttribute(s_formatAttri);

            HtmlScreenInputElement screenInput = new HtmlScreenInputElement(argElement, this);

            if (!string.IsNullOrEmpty(format))
            {
                screenInput.FormatPattern = format;
            }
            screenInput.ParseBindingExpress();

            //show virtual keyboard
            string showVKeyboard = argElement.GetAttribute(UIPropertyKey.s_showVirtualKeyboard);

            if (!string.IsNullOrEmpty(showVKeyboard))
            {
                int value = 0;
                if (int.TryParse(showVKeyboard, out value))
                {
                    screenInput.CanShowVirtualKeyboard = value == 0 ? false : true;
                }
                else
                {
                    screenInput.CanShowVirtualKeyboard = false;
                }
            }

            return(screenInput);
        }
        System.Windows.Forms.HtmlElement Finding_Parent_With_Identifier(System.Windows.Forms.HtmlElement element)
        {
            // System.Windows.Forms.HtmlElement parent = element.Parent;

            string className = element.GetAttribute("className");
            string idName    = element.GetAttribute("id");
            string name      = element.GetAttribute("name").Trim();
            string tagName   = element.TagName;

            parentCounting++;

            return(idName != string.Empty ? element : Finding_Parent_With_Identifier(element.Parent));
        }
Example #3
0
 public void Update(System.Windows.Forms.HtmlElement elem)
 {
     Int32.TryParse(elem.GetAttribute("indent"), out this.indent);
     this.tabName    = this.GetElementByName(elem, "tableau").InnerText;
     this.expression = this.GetElementByName(elem, "expression").InnerText;
     this.fieldName  = this.GetElementByName(elem, "champ").InnerText;
 }
Example #4
0
        /// <summary>
        /// When saving the CodeCommander file source, receipts and updates infos from the tml element of the web navigator
        /// </summary>
        /// <param name="elem">html element</param>
        public void Update(System.Windows.Forms.HtmlElement elem)
        {
            Int32.TryParse(elem.GetAttribute("indent"), out this.indent);
            this.language = this.GetElementByName(elem, "language").InnerText;
            this.name     = this.GetElementByName(elem, "name").InnerText;
            string strParams = this.GetElementByName(elem, "params").InnerText;

            this.refs.Clear();
            if (!String.IsNullOrEmpty(strParams))
            {
                string[] tab = strParams.Split(',');
                foreach (string param in tab)
                {
                    string name = param.Trim();
                    if (name.StartsWith(CreateMOP.ParamIdentifier.ToString()))
                    {
                        name = name.Substring(1).Trim();
                    }
                    if (!String.IsNullOrEmpty(name))
                    {
                        if (!this.refs.Contains(name))
                        {
                            this.refs.Add(name);
                        }
                    }
                }
            }
            // mise à jour des legendes
            this.legendes.Update(this.GetElementByName(elem, "myLegendes"));
            this.xmlCode = this.GetElementByName(elem, "xml").InnerHtml;
        }
Example #5
0
        //Má na starosti extrakci přímých odkazů z podporovaných stránek
        private void ResolveLink()
        {
            string href = "";

            if (Provider == Providers.Zippyshare)
            {
                System.Windows.Forms.HtmlElement element = webBrowser.Document.GetElementById("dlbutton");
                if (element != null)
                {
                    href = element.GetAttribute("href");
                }
                else
                {
                    OnExtractionError?.Invoke(Lang.Translate("lang_unable_to_extract"));
                    return;
                }
            }
            else if (Provider == Providers.Openload)
            {
                System.Windows.Forms.HtmlElement element = webBrowser.Document.GetElementById("streamurj");
                if (element != null)
                {
                    href = "/stream/" + element.InnerText;
                }
                else
                {
                    OnExtractionError?.Invoke(Lang.Translate("lang_unable_to_extract"));
                    return;
                }
            }
            Uri uri = new Uri(new Uri(webBrowser.Url.AbsoluteUri), href);

            OnExtractionCompleted?.Invoke(WebUtility.UrlDecode(uri.AbsoluteUri));
        }
 public void Update(System.Windows.Forms.HtmlElement elem)
 {
     Int32.TryParse(elem.GetAttribute("indent"), out this.indent);
     this.expression = this.GetElementByName(elem, "expression").InnerText;
     this.labelTrue  = this.GetElementByName(elem, "labelTrue").InnerText;
     this.labelFalse = this.GetElementByName(elem, "labelFalse").InnerText;
 }
Example #7
0
        void document_MouseDown(object sender, System.Windows.Forms.HtmlElementEventArgs e)
        {
            System.Windows.Forms.HtmlElement element = this.web.Document.GetElementFromPoint(e.ClientMousePosition);
            //string right_button_capture = element.GetAttribute("id");
            //selenium_id= htmlDocument2.body.document.document.getElementById("username");
            selenium_id      = element.GetAttribute("id").Trim();
            selenium_name    = element.GetAttribute("name").Trim();
            selenium_tagName = element.TagName.ToString();

            //MessageBox.Show("tag name=" + selenium_tagName + " name=" + selenium_name + " id=" + selenium_id);

            if (e.MouseButtonsPressed == System.Windows.Forms.MouseButtons.Right)
            {
                //MessageBox.Show(right_button_capture);
            }
        }
Example #8
0
        private void document_MouseOver(object sender, System.Windows.Forms.HtmlElementEventArgs e)
        {
            System.Windows.Forms.HtmlElement element = e.ToElement;


            string dozmiany = element.OuterHtml;

            //textEditor1.Text = "ttttttttttttt" + dozmiany;


            if (!this.elementStyles.ContainsKey(element))
            {
                string style = element.Style;
                this.elementStyles.Add(element, style);
                //element.SetAttribute("data-tooltip", "tooooltip");

                //element.Style = style + "background-color: #ffc;border: 2px dotted #000000;background-clip:border-box";   // border - color: coral;  border-style: solid;
                // element.Style = style + ";data-tooltip=\"Custom tooltip text.\";";                                                            // element.Style = style + "; padding: 15px;";
                // data-tooltip="Custom tooltip text."


                if (element.GetAttribute("className") != "")
                {
                    element.Style = style + "background-color: rgba(30, 163, 97, 0.25);border: 2px dotted #000000;background-clip:border-box";
                }
                else
                {
                    element.Style = style + "background-color: rgba(255, 2, 2, 0.25);border: 2px dotted #000000;background-clip:border-box";
                }
            }


            //string ffff = wartosc.XPath;
        }
Example #9
0
 /// <summary>
 /// Updates data from the web browser (before save)
 /// </summary>
 /// <param name="elem">html element</param>
 public void Update(System.Windows.Forms.HtmlElement elem)
 {
     Int32.TryParse(elem.GetAttribute("indent"), out this.indent);
     this.language = this.GetElementByName(elem, "language").InnerText;
     if (String.IsNullOrEmpty(this.language))
     {
         this.language = "";
     }
     this.command    = this.GetElementByName(elem, "command").InnerText;
     this.expression = this.GetElementByName(elem, "expression").InnerText;
 }
Example #10
0
        /// <summary>
        /// Updates data from the web browser (before save)
        /// </summary>
        /// <param name="elem">html element</param>
        public void Update(System.Windows.Forms.HtmlElement elem)
        {
            Int32.TryParse(elem.GetAttribute("indent"), out this.indent);
            string name = this.GetElementByName(elem, "name").InnerText;

            if (String.IsNullOrEmpty(name))
            {
                name = "";
            }
            this.name = name;
            // mise à jour des légendes
            this.legendes.Update(this.GetElementByName(elem, "myLegendes"));
            this.xmlCode = this.GetElementByName(elem, "xml").InnerHtml;
        }
        /// <summary>
        /// Updates data from the web browser (before save)
        /// </summary>
        /// <param name="elem">html element</param>
        public void Update(System.Windows.Forms.HtmlElement elem)
        {
            Int32.TryParse(elem.GetAttribute("indent"), out this.indent);
            string path = this.GetElementByName(elem, "path").InnerText;

            if (String.IsNullOrEmpty(path))
            {
                path = "";
            }
            int pos = path.LastIndexOf("/");

            if (pos != -1)
            {
                this.path = path.Substring(0, pos);
                this.name = path.Substring(pos + 1);
            }
            else
            {
                this.name = path;
                this.path = "";
            }
            string strParams = this.GetElementByName(elem, "params").InnerText;

            this.pars = new Dictionary <string, string>();
            if (!String.IsNullOrEmpty(strParams))
            {
                string[] tab = strParams.Split(',');
                foreach (string param in tab)
                {
                    string name = String.Empty;
                    if (param.Trim().StartsWith(Template.ParamIdentifier.ToString()))
                    {
                        name = param.Trim().Substring(1).Trim();
                    }
                    else
                    {
                        name = param.Trim();
                    }
                    if (!this.pars.ContainsKey(name))
                    {
                        this.pars.Add(name, "");
                    }
                }
            }
            // mise à jour des legendes
            this.legendes.Update(this.GetElementByName(elem, "myLegendes"));
            this.xmlCode = this.GetElementByName(elem, "xml").InnerHtml;
        }
Example #12
0
        /// <summary>
        /// Update summary from html element
        /// </summary>
        /// <param name="elem">html element object</param>
        public void Update(System.Windows.Forms.HtmlElement elem)
        {
            this.context     = elem.GetAttribute("context");
            this.name        = elem.GetAttribute("name");
            this.description = elem.GetAttribute("description");
            this.type        = elem.GetAttribute("typeLegende");
            this.expression  = elem.GetAttribute("expression");
            this.commentaire = elem.GetAttribute("commentaire");
            this.free        = Boolean.Parse(elem.GetAttribute("free"));
            o2Mate.LocaleGroup group = new LocaleGroup();
            string             groupName, localeName;

            if (group.ExtractGroupAndName(this.description, out groupName, out localeName))
            {
                if (!group.Exists(groupName))
                {
                    group.Create(groupName);
                }
                o2Mate.ILocaleSet set = group.Get(groupName);
                if (!set.ExistsOne(localeName, "fr-FR"))
                {
                    set.Add(localeName, "fr-FR", "");
                }
                if (!set.ExistsOne(localeName, "en-US"))
                {
                    set.Add(localeName, "en-US", "");
                }
            }
            if (group.ExtractGroupAndName(this.commentaire, out groupName, out localeName))
            {
                if (!group.Exists(groupName))
                {
                    group.Create(groupName);
                }
                o2Mate.ILocaleSet set = group.Get(groupName);
                if (!set.ExistsOne(localeName, "fr-FR"))
                {
                    set.Add(localeName, "fr-FR", "");
                }
                if (!set.ExistsOne(localeName, "en-US"))
                {
                    set.Add(localeName, "en-US", "");
                }
            }
        }
Example #13
0
        public void Update(System.Windows.Forms.HtmlElement elem)
        {
            Int32.TryParse(elem.GetAttribute("indent"), out this.indent);
            string path = this.GetElementByName(elem, "path").InnerText;

            if (String.IsNullOrEmpty(path))
            {
                path = "";
            }
            int pos = path.LastIndexOf("/");

            if (pos != -1)
            {
                this.path = path.Substring(0, pos);
                this.name = path.Substring(pos + 1);
            }
            else
            {
                this.name = path;
                this.path = "";
            }
        }
Example #14
0
        public void Update(System.Windows.Forms.HtmlElement elem)
        {
            Int32.TryParse(elem.GetAttribute("indent"), out this.indent);
            this.writerName = this.GetElementByName(elem, "writer").InnerText;
            if (String.IsNullOrEmpty(this.writerName))
            {
                this.writerName = "";
            }
            string strFile = this.GetElementByName(elem, "file").InnerText;

            this.filePath = new List <string>();
            string[] splitPath = strFile.Split('/');
            foreach (string directory in splitPath)
            {
                if (!String.IsNullOrEmpty(directory))
                {
                    string value = directory;
                    value = value.Replace("&", "&amp;");
                    value = value.Replace("<", "&lt;");
                    value = value.Replace(">", "&gt;");
                    this.filePath.Add(value);
                }
            }
        }
Example #15
0
 public void Update(System.Windows.Forms.HtmlElement elem)
 {
     Int32.TryParse(elem.GetAttribute("indent"), out this.indent);
 }
Example #16
0
        void document_MouseDown(object sender, System.Windows.Forms.HtmlElementEventArgs e)
        {
            System.Windows.Forms.HtmlElement element = this.automation_browser.Document.GetElementFromPoint(e.ClientMousePosition);

            string className = element.GetAttribute("className");
            string tagName   = element.TagName;


            if (e.MouseButtonsPressed == System.Windows.Forms.MouseButtons.Right)
            {
                //string innerhtml = element.InnerHtml;
                if (!Element.Contains(element))
                {
                    List <string> AttributeName = new List <string>()
                    {
                        "name", "id", "value", "href", "src", "title", "type", "text", "class"
                    };


                    System.Windows.Forms.HtmlElementCollection links = automation_browser.Document.GetElementsByTagName(tagName);



                    //MessageBox.Show( tagName+" "+ className);



                    string           msgtext = "Select this Element?";
                    string           txt     = Application.Current.MainWindow.Title;
                    MessageBoxButton button  = MessageBoxButton.YesNoCancel;
                    MessageBoxResult result  = MessageBox.Show(msgtext, txt, button);

                    switch (result)
                    {
                    case MessageBoxResult.Yes:
                        Element.Add(element);
                        if (className != "")
                        {
                            foreach (System.Windows.Forms.HtmlElement link in links)
                            {
                                if (link.GetAttribute("className") == className)
                                {
                                    DataList.Add(link.InnerText);
                                    HtmlList.Add(link.OuterHtml);
                                }
                            }
                        }
                        else
                        {
                            foreach (System.Windows.Forms.HtmlElement link in links)
                            {
                                if (link.TagName == tagName)
                                {
                                    DataList.Add(link.InnerText);
                                    HtmlList.Add(link.OuterHtml);
                                }
                            }
                        }



                        break;

                    case MessageBoxResult.No:



                        break;

                    case MessageBoxResult.Cancel:

                        break;
                    }
                }
            }
        }
 public void Update(System.Windows.Forms.HtmlElement elem)
 {
     this.varName    = this.GetElementByName(elem, "varName").InnerText;
     this.expression = this.GetElementByName(elem, "expression").InnerText;
     Int32.TryParse(elem.GetAttribute("indent"), out this.indent);
 }
 /// <summary>
 /// Updates data from the web browser (before save)
 /// </summary>
 /// <param name="elem">html element</param>
 public void Update(System.Windows.Forms.HtmlElement elem)
 {
     Int32.TryParse(elem.GetAttribute("indent"), out this.indent);
     this.name = this.GetElementByName(elem, "name").InnerText;
 }
Example #19
0
        void document_MouseDown(object sender, System.Windows.Forms.HtmlElementEventArgs e)
        {
            System.Windows.Forms.HtmlElement element = this.automation_browser.Document.GetElementFromPoint(e.ClientMousePosition);

            //******************* for testing XPATH *****************



            var savedId  = element.Id;
            var uniqueId = Guid.NewGuid().ToString();

            element.Id = uniqueId;

            var doc = new HtmlAgilityPack.HtmlDocument();

            doc.LoadHtml(element.Document.GetElementsByTagName("html")[0].OuterHtml);
            element.Id = savedId;

            var    node  = doc.GetElementbyId(uniqueId);
            string xpath = node.XPath;



            string[] parentNodes = xpath.Split('/');

            parentCounting = 0;

            System.Windows.Forms.HtmlElement starting_element = Finding_Parent_With_Identifier(element);

            string starting_element_idName = starting_element.GetAttribute("id");

            string startingPattern = @"//*[@";
            string middlePattern   = "=" + '"'; //"="";
            string endingPattern   = '"' + "]"; //""]";

            string XPATH = startingPattern + "id" + middlePattern + starting_element_idName + endingPattern;

            for (int i = parentNodes.Length - parentCounting + 1; i < parentNodes.Length; i++)
            {
                string tmp = '/' + parentNodes[i];
                XPATH += tmp;
            }



            //******************* for testing XPATH *****************

            if (e.MouseButtonsPressed == System.Windows.Forms.MouseButtons.Right)
            {
                //Window wi = new Window();


                //ContextMenu contextMenuForPopulateText = new ContextMenu();


                //MenuItem item1 = new MenuItem();

                //item1.Header = "Select this Text-Field";
                ////item1.AddHandler(RoutedEvent r, )

                //contextMenuForPopulateText.Items.Add(item1);

                //wi.ContextMenu = contextMenuForPopulateText;

                //wi.ResizeMode = System.Windows.ResizeMode.NoResize;


                ////wi.MaxHeight = contextMenuForPopulateText.Height;
                ////wi.MaxWidth = contextMenuForPopulateText.Width;



                //wi.Show();



                //MessageDialog newr = new MessageDialog();

                //var metroWindow = (Application.Current.MainWindow as MetroWindow);


                //metroWindow.ShowDialog();


                //var metroWindow = (Application.Current.MainWindow as MetroWindow);
                // metroWindow.ShowMessageAsync("title", "message...");



                string element_tagName = element.TagName.ToString();
                if (element_tagName.ToLower() == "input")
                {
                    selenium_id = element.GetAttribute("id").Trim();
                    if (!input_id_check_str.Contains(selenium_id.ToLower()))
                    {
                        string           msgtext = "Select this Text-field?";
                        string           txt     = Application.Current.MainWindow.Title;
                        MessageBoxButton button  = MessageBoxButton.YesNoCancel;
                        MessageBoxResult result  = MessageBox.Show(msgtext, txt, button);

                        switch (result)
                        {
                        case MessageBoxResult.Yes:


                            input_id_check_str.Add(selenium_id.ToLower());
                            selenium_name = element.GetAttribute("name").Trim();
                            string input = Interaction.InputBox(selenium_id, "Input text", "");
                            if (input.Trim() != "")
                            {
                                AutomationBrowser_HtmlElementInfo.Add(new HtmlElementInfo()
                                {
                                    Html_element_id         = selenium_id,
                                    Html_element_name       = selenium_name,
                                    Html_element_input_text = input,
                                    Html_element_XPATH      = XPATH
                                });
                            }
                            //(this.Parent as MetroWindow).DialogResult = true;
                            //(this.Parent as MetroWindow).Close();
                            break;

                        case MessageBoxResult.No:

                            break;

                        case MessageBoxResult.Cancel:

                            break;
                        }
                    }
                    else
                    {
                        //MessageBox.Show("You have already entered value in thid field.");
                    }
                }
                else
                {
                    MessageBox.Show("Please, Focus only INPUT Field");
                }
            }
        }
        void document_MouseDown(object sender, System.Windows.Forms.HtmlElementEventArgs e)
        {
            System.Windows.Forms.HtmlElement element = this.automation_browser.Document.GetElementFromPoint(e.ClientMousePosition);

            //if (e.MouseButtonsPressed == System.Windows.Forms.MouseButtons.Right)
            //{
            //    //System.Windows.Forms.ContextMenu BrowserContextMenu = new System.Windows.Forms.ContextMenu();



            //    //System.Windows.Forms.MenuItem MenuItem1 = new System.Windows.Forms.MenuItem { Text = "SELECT THIS OBJECT" };
            //    //MenuItem1.Click += new EventHandler(delegate { MessageBox.Show("L1 Click"); });



            //    ////MenuItem1.PerformClick()

            //    //BrowserContextMenu.MenuItems.Add(MenuItem1);

            //    //System.Windows.Forms.MenuItem MenuItem2 = new System.Windows.Forms.MenuItem { Text = "SELECT THIS OBJECT" };
            //    //MenuItem2.Click += MenuItemOnClick;
            //    //BrowserContextMenu.MenuItems.Add(MenuItem2);

            //    //automation_browser.ContextMenu = BrowserContextMenu;

            //    //put the browser control in the windows forms host


            //}

            //******************* for testing XPATH *****************



            var savedId  = element.Id;
            var uniqueId = Guid.NewGuid().ToString();

            element.Id = uniqueId;

            var doc = new HtmlAgilityPack.HtmlDocument();

            doc.LoadHtml(element.Document.GetElementsByTagName("html")[0].OuterHtml);
            element.Id = savedId;

            var    node  = doc.GetElementbyId(uniqueId);
            string xpath = node.XPath;



            string[] parentNodes = xpath.Split('/');

            parentCounting = 0;

            System.Windows.Forms.HtmlElement starting_element = Finding_Parent_With_Identifier(element);

            string starting_element_idName = starting_element.GetAttribute("id");

            string startingPattern = @"//*[@";
            string middlePattern   = "=" + '"'; //"="";
            string endingPattern   = '"' + "]"; //""]";

            string XPATH = startingPattern + "id" + middlePattern + starting_element_idName + endingPattern;

            for (int i = parentNodes.Length - parentCounting + 1; i < parentNodes.Length; i++)
            {
                string tmp = '/' + parentNodes[i];
                XPATH += tmp;
            }



            //******************* for testing XPATH *****************

            if (e.MouseButtonsPressed == System.Windows.Forms.MouseButtons.Right)
            {
                string element_tagName = element.TagName.ToString();

                selenium_id = element.GetAttribute("id").Trim();

                selenium_class = element.GetAttribute("className").Trim();
                if (!input_id_check_str.Contains(selenium_id.ToLower()))
                {
                    string           msgtext = "Select this Object?";
                    string           txt     = Application.Current.MainWindow.Title;
                    MessageBoxButton button  = MessageBoxButton.YesNoCancel;
                    MessageBoxResult result  = MessageBox.Show(msgtext, txt, button);

                    switch (result)
                    {
                    case MessageBoxResult.Yes:


                        input_id_check_str.Add(selenium_id.ToLower());
                        selenium_name = element.GetAttribute("name").Trim();
                        AutomationBrowser_HtmlElementInfo.Add(new HtmlElementInfo()
                        {
                            Html_element_id    = selenium_id,
                            Html_element_name  = selenium_name,
                            Html_element_class = selenium_class,
                            Html_element_XPATH = XPATH
                        });

                        //(this.Parent as MetroWindow).DialogResult = true;
                        //(this.Parent as MetroWindow).Close();
                        break;

                    case MessageBoxResult.No:

                        break;

                    case MessageBoxResult.Cancel:

                        break;
                    }
                }
            }
        }
        void document_MouseDown(object sender, System.Windows.Forms.HtmlElementEventArgs e)
        {
            try
            {
                if (e.MouseButtonsPressed == System.Windows.Forms.MouseButtons.Right)
                {
                    System.Windows.Forms.HtmlElement element = this.automation_browser.Document.GetElementFromPoint(e.ClientMousePosition);

                    //System.Windows.Forms.HtmlElement xPath_element = this.automation_browser.Document.GetElementFromPoint(e.ClientMousePosition);



                    //******************* for testing XPATH *****************



                    var savedId  = element.Id;
                    var uniqueId = Guid.NewGuid().ToString();
                    element.Id = uniqueId;

                    var doc = new HtmlAgilityPack.HtmlDocument();
                    doc.LoadHtml(element.Document.GetElementsByTagName("html")[0].OuterHtml);
                    element.Id = savedId;

                    var    node  = doc.GetElementbyId(uniqueId);
                    string xpath = node.XPath;



                    string[] parentNodes = xpath.Split('/');

                    parentCounting = 0;

                    try
                    {
                        System.Windows.Forms.HtmlElement starting_element = Finding_Parent_With_Identifier(element);

                        string starting_element_idName = starting_element.GetAttribute("id");

                        string startingPattern = @"//*[@";
                        string middlePattern   = "=" + '"'; //"="";
                        string endingPattern   = '"' + "]"; //""]";

                        string XPATH = startingPattern + "id" + middlePattern + starting_element_idName + endingPattern;

                        for (int i = parentNodes.Length - parentCounting + 1; i < parentNodes.Length; i++)
                        {
                            string tmp = '/' + parentNodes[i];
                            XPATH += tmp;
                        }
                    }
                    catch (Exception ex)
                    {
                    }



                    //******************* for testing XPATH *****************



                    string element_tagName = element.TagName.ToString();
                    //string innerHtml=element.TagName.
                    //string element_outerHTML = element2.OuterHtml;


                    //MessageBox.Show("inner html= " + element.InnerHtml);
                    //MessageBox.Show("inner text= "+ element.InnerText);
                    //MessageBox.Show("class name= "+element.GetAttribute("class").Trim());

                    //MessageBox.Show(element_tagName);


                    //MessageBox.Show("id= "+element.GetAttribute("id"));
                    //MessageBox.Show("name= "+element.GetAttribute("name"));
                    //MessageBox.Show("inner text= " + element.InnerText);
                    //MessageBox.Show("inner html= " + element.InnerHtml);

                    selenium_id = element.GetAttribute("id").Trim();

                    System.Windows.Forms.HtmlElement aelement = automation_browser.Document.GetElementById(selenium_id);


                    // MessageBox.Show(selectedIndex.ToString());

                    //MessageBox.Show(element_tagName);
                    //if (element_tagName.ToLower() == "select")
                    //{
                    selenium_id = element.GetAttribute("id").Trim();
                    if (!input_id_check_str.Contains(selenium_id.ToLower()))
                    {
                        string           msgtext = "Select this Drop-Down?";
                        string           txt     = Application.Current.MainWindow.Title;
                        MessageBoxButton button  = MessageBoxButton.YesNoCancel;
                        MessageBoxResult result  = MessageBox.Show(msgtext, txt, button);

                        switch (result)
                        {
                        case MessageBoxResult.Yes:


                            input_id_check_str.Add(selenium_id.ToLower());
                            selenium_name = element.GetAttribute("name").Trim();

                            object objElement       = element.DomElement;
                            object objSelectedIndex = objElement.GetType().InvokeMember("selectedIndex",
                                                                                        BindingFlags.GetProperty, null, objElement, null);
                            int selectedIndex = (int)objSelectedIndex;

                            // MessageBox.Show("in yes indes= "+selectedIndex);

                            AutomationBrowser_HtmlElementInfo.Add(new HtmlElementInfo()
                            {
                                Html_element_id      = selenium_id,
                                Html_element_name    = selenium_name,
                                Html_drop_down_index = selectedIndex,
                                //Html_element_XPATH = XPATH
                            });



                            //(this.Parent as MetroWindow).DialogResult = true;
                            //(this.Parent as MetroWindow).Close();
                            break;

                        case MessageBoxResult.No:

                            break;

                        case MessageBoxResult.Cancel:

                            break;
                        }
                    }
                    else
                    {
                        //MessageBox.Show("You have already entered value in thid field.");
                    }

                    // }
                    //else
                    //{
                    //    MessageBox.Show("Please, Focus only Drop-Down");
                    //}
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        void document_MouseDown(object sender, System.Windows.Forms.HtmlElementEventArgs e)
        {
            try
            {
                if (e.MouseButtonsPressed == System.Windows.Forms.MouseButtons.Right)
                {
                    System.Windows.Forms.HtmlElement element = this.automation_browser.Document.GetElementFromPoint(e.ClientMousePosition);

                    string className = element.GetAttribute("className");
                    string idName    = element.GetAttribute("id");
                    string tagName   = element.TagName;
                    string name      = element.GetAttribute("name").Trim();


                    //******************* for testing XPATH *****************



                    var savedId  = element.Id;
                    var uniqueId = Guid.NewGuid().ToString();
                    element.Id = uniqueId;

                    var doc = new HtmlAgilityPack.HtmlDocument();
                    doc.LoadHtml(element.Document.GetElementsByTagName("html")[0].OuterHtml);
                    element.Id = savedId;

                    var    node  = doc.GetElementbyId(uniqueId);
                    string xpath = node.XPath;



                    string[] parentNodes = xpath.Split('/');

                    parentCounting = 0;
                    string XPATH = "";
                    try
                    {
                        System.Windows.Forms.HtmlElement starting_element = Finding_Parent_With_Identifier(element);

                        string starting_element_idName = starting_element.GetAttribute("id");

                        string startingPattern = @"//*[@";
                        string middlePattern   = "=" + '"'; //"="";
                        string endingPattern   = '"' + "]"; //""]";

                        XPATH = startingPattern + "id" + middlePattern + starting_element_idName + endingPattern;

                        for (int i = parentNodes.Length - parentCounting + 1; i < parentNodes.Length; i++)
                        {
                            string tmp = '/' + parentNodes[i];
                            XPATH += tmp;
                        }
                    }
                    catch (Exception ex)
                    {
                    }



                    //******************* for testing XPATH *****************


                    //MessageBox.Show(XPATH);

                    //MessageBox.Show(xpath);

                    string element_tagName = element.TagName.ToString();

                    selenium_id = element.GetAttribute("id").Trim();
                    if (!input_id_check_str.Contains(selenium_id.ToLower()))
                    {
                        string           msgtext = "Select this Element?";
                        string           txt     = Application.Current.MainWindow.Title;
                        MessageBoxButton button  = MessageBoxButton.YesNoCancel;
                        MessageBoxResult result  = MessageBox.Show(msgtext, txt, button);

                        switch (result)
                        {
                        case MessageBoxResult.Yes:


                            input_id_check_str.Add(selenium_id.ToLower());
                            selenium_name = element.GetAttribute("name").Trim();
                            screenshot_HtmlElementInfo = new HtmlElementInfo()
                            {
                                Html_element_id    = selenium_id,
                                Html_element_name  = selenium_name,
                                Html_element_class = className,
                                Html_element_tag   = element_tagName,
                                Html_element_XPATH = XPATH
                            };

                            //(this.Parent as MetroWindow).DialogResult = true;
                            //(this.Parent as MetroWindow).Close();
                            break;

                        case MessageBoxResult.No:

                            break;

                        case MessageBoxResult.Cancel:

                            break;
                        }
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }