Esempio n. 1
0
        /// <summary>
        /// Gets the checkbox on change values.
        /// </summary>
        /// <returns></returns>
        private List <HpacInput> GetCheckboxOnChangeValues()
        {
            List <HpacInput> onchangeValues = new List <HpacInput>();
            string           docListXpath   = "//input[@type='checkbox']";
            string           rawHtml        = string.Empty;

            rawHtml = _engine.GetBrowserHtml();
            var doc = new HtmlAgilityPack.HtmlDocument();

            doc.LoadHtml(rawHtml);
            var nodes = doc.DocumentNode.SelectNodes(docListXpath);

            if (nodes != null)
            {
                foreach (var node in nodes)
                {
                    HpacInput hi = new HpacInput();
                    foreach (var attribute in node.Attributes)
                    {
                        hi.CheckboxId = node.Id;
                        if (attribute.Name.Equals("onchange"))
                        {
                            hi.OnchangeValue = attribute.Value;
                            onchangeValues.Add(hi);
                        }
                    }
                }
            }
            return(onchangeValues);
        }
Esempio n. 2
0
        /// <summary>
        /// Gets the checkbox ID for further processing
        /// </summary>
        /// <returns>HpacInput</returns>
        public HpacInput GetCheckboxOnchangeValue()
        {
            HpacInput        checkboxId  = new HpacInput();
            List <HpacInput> checkboxIds = GetCheckboxOnChangeValues();

            if (checkboxIds.Count > 0)
            {
                checkboxId = checkboxIds[0];
            }

            return(checkboxId);
        }