void InsertMouseControl(frmMouseHandle frm)
        {
            if (frmGroup == null || fpBody.Controls[frmGroup.Name] == null)
            {
                InsertGroupControl();
            }

            frm.Name = $"{id}";
            frm.Text = $"Mouse {id}";
            frm.Show();

            frmGroup.InsertControl(frm);
            id++;
        }
        private void BtnDone_Click(object sender, EventArgs e)
        {
            List <ActionData> lstSteps = new List <ActionData>();

            foreach (Control ctrGroup in fpBody.Controls)
            {
                if (ctrGroup is frmGroupHandle)
                {
                    List <Control> lstControls = ((frmGroupHandle)ctrGroup).GetChildControl();
                    ActionData     action      = new ActionData();
                    action.Actions = new List <Action <ChromiumWebBrowser> >();

                    foreach (Control ctrControl in lstControls)
                    {
                        if (!(ctrControl is frmMouseHandle) && !(ctrControl is frmInputHandle))
                        {
                            continue;
                        }

                        if (ctrControl is frmMouseHandle)
                        {
                            frmMouseHandle frm = ctrControl as frmMouseHandle;
                            string         strHandle;
                            string         strQuery;
                            bool           isPosition;
                            int            iX;
                            int            iY;
                            frm.GetData(out strHandle, out strQuery, out isPosition, out iX, out iY);

                            if (isPosition)
                            {
                                if (strHandle.Equals(Define.DblClick))
                                {
                                    action.Actions.Add(new Action <ChromiumWebBrowser>((_browser) =>
                                    {
                                        _browser.InitMouseHandlePoint();
                                        _browser.SendMouseHandle(Define.Click, iX, iY);
                                        _browser.SendMouseHandle(Define.Click, iX, iY);
                                    }));
                                }
                                else
                                {
                                    action.Actions.Add(new Action <ChromiumWebBrowser>((_browser) =>
                                    {
                                        _browser.InitMouseHandlePoint();
                                        _browser.SendMouseHandle(strHandle, iX, iY);
                                    }));
                                }
                            }
                            else
                            {
                                if (strHandle.Equals(Define.DblClick))
                                {
                                    action.Actions.Add(new Action <ChromiumWebBrowser>((_browser) =>
                                    {
                                        _browser.InitMouseHandle();
                                        _browser.SendMouseHandle(Define.Click, strQuery);
                                        _browser.SendMouseHandle(Define.Click, strQuery);
                                    }));
                                }
                                else
                                {
                                    action.Actions.Add(new Action <ChromiumWebBrowser>((_browser) =>
                                    {
                                        _browser.InitMouseHandle();
                                        _browser.SendMouseHandle(strHandle, strQuery);
                                    }));
                                }
                            }
                        }
                        else if (ctrControl is frmInputHandle)
                        {
                            frmInputHandle frm = ctrControl as frmInputHandle;
                            string         strValue;
                            string         strQuery;
                            frm.GetData(out strQuery, out strValue);

                            action.Actions.Add(new Action <ChromiumWebBrowser>((_browser) =>
                            {
                                _browser.SendText(strQuery, strValue);
                            }));
                        }
                    }

                    if (action.Actions.Count > 0)
                    {
                        lstSteps.Add(action);
                    }
                }
            }

            ResendData?.Invoke(txtUrl.Text.Trim(), lstSteps);
        }
        void SaveData(string fileName)
        {
            try
            {
                XmlDocument xmlDoc = new XmlDocument();

                this.fileName = fileName;
                if (System.IO.File.Exists(fileName))
                {
                    xmlDoc.Load(fileName);
                }
                else
                {
                    xmlDoc.InitDocument();
                }

                XmlNode xmlPage = xmlDoc.SelectSingleNode($"/{Define.Page}");
                xmlPage.RemoveAll();

                /*Save Url*/
                if (xmlPage.Attributes[Define.Url] == null)
                {
                    xmlPage.Attributes.Append(xmlDoc.CreateAttribute(Define.Url));
                }

                xmlPage.Attributes[Define.Url].Value = txtUrl.Text.Trim();

                /*Save XML*/
                foreach (Control ctrGroup in fpBody.Controls)
                {
                    #region Group
                    if (ctrGroup is frmGroupHandle)
                    {
                        XmlElement     xmlGroup    = xmlDoc.CreateElement(Define.Group);
                        List <Control> lstControls = ((frmGroupHandle)ctrGroup).GetChildControl();

                        foreach (Control ctrControl in lstControls)
                        {
                            if (ctrControl is frmMouseHandle)
                            {
                                frmMouseHandle frm = ctrControl as frmMouseHandle;
                                string         strHandle;
                                string         strQuery;
                                bool           isPosition;
                                int            iX;
                                int            iY;
                                frm.GetData(out strHandle, out strQuery, out isPosition, out iX, out iY);

                                if (isPosition)
                                {
                                    XmlElement xmlControl             = xmlDoc.CreateElement(Define.Control);
                                    Dictionary <string, string> attrs = new Dictionary <string, string>();
                                    attrs.Add(Define.Type, Define.Mouse);
                                    attrs.Add(Define.Handle, strHandle.ToLower());
                                    attrs.Add(Define.Query, strQuery);
                                    attrs.Add(Define.IsPosition, isPosition.ToString());
                                    attrs.Add(Define.PositionX, iX.ToString());
                                    attrs.Add(Define.PositionY, iY.ToString());
                                    attrs.ToList().ForEach(x =>
                                    {
                                        XmlAttribute xmlAttr = xmlDoc.CreateAttribute(x.Key);
                                        xmlAttr.Value        = x.Value;
                                        xmlControl.Attributes.Append(xmlAttr);
                                    });
                                    xmlGroup.AppendChild(xmlControl);
                                }
                                else
                                {
                                    XmlElement xmlControl             = xmlDoc.CreateElement(Define.Control);
                                    Dictionary <string, string> attrs = new Dictionary <string, string>();
                                    attrs.Add(Define.Type, Define.Mouse);
                                    attrs.Add(Define.Handle, strHandle.ToLower());
                                    attrs.Add(Define.Query, strQuery);
                                    attrs.ToList().ForEach(x =>
                                    {
                                        XmlAttribute xmlAttr = xmlDoc.CreateAttribute(x.Key);
                                        xmlAttr.Value        = x.Value;
                                        xmlControl.Attributes.Append(xmlAttr);
                                    });
                                    xmlGroup.AppendChild(xmlControl);
                                }
                            }
                            else if (ctrControl is frmInputHandle)
                            {
                                frmInputHandle frm = ctrControl as frmInputHandle;
                                string         strValue;
                                string         strQuery;
                                frm.GetData(out strQuery, out strValue);

                                XmlElement xmlControl             = xmlDoc.CreateElement(Define.Control);
                                Dictionary <string, string> attrs = new Dictionary <string, string>();
                                attrs.Add(Define.Type, Define.Input);
                                attrs.Add(Define.Query, strQuery);
                                attrs.Add(Define.Value, strValue);
                                attrs.ToList().ForEach(x =>
                                {
                                    XmlAttribute xmlAttr = xmlDoc.CreateAttribute(x.Key);
                                    xmlAttr.Value        = x.Value;
                                    xmlControl.Attributes.Append(xmlAttr);
                                });
                                xmlGroup.AppendChild(xmlControl);
                            }
                        }

                        xmlPage.AppendChild(xmlGroup);
                    }
                    #endregion
                }

                xmlDoc.Save(fileName);
            }
            catch (Exception ex)
            {
                this.showError(Caption: ex.Message);
            }
        }